Register the console lazily in CLI type registrar

This should fix a strange bug we're seeing in Cake on macOS.
This commit is contained in:
Patrik Svensson
2021-02-12 00:02:59 +01:00
committed by Patrik Svensson
parent fd217ffc83
commit 28e9c14de4
5 changed files with 47 additions and 1 deletions

View File

@ -27,5 +27,15 @@ namespace Injection
{
_builder.AddSingleton(service, implementation);
}
public void RegisterLazy(Type service, Func<object> func)
{
if (func is null)
{
throw new ArgumentNullException(nameof(func));
}
_builder.AddSingleton(service, (provider) => func());
}
}
}