More granualr null checks for platform services
This commit is contained in:
parent
02de506c28
commit
fa72b35883
|
|
@ -92,12 +92,28 @@ namespace Microsoft.AspNet.Hosting
|
||||||
_configureServices(services);
|
_configureServices(services);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlatformServices.Default != null)
|
if (PlatformServices.Default?.Application != null)
|
||||||
{
|
{
|
||||||
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.Application));
|
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.Application));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PlatformServices.Default?.Runtime != null)
|
||||||
|
{
|
||||||
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.Runtime));
|
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.Runtime));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PlatformServices.Default?.AssemblyLoadContextAccessor != null)
|
||||||
|
{
|
||||||
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.AssemblyLoadContextAccessor));
|
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.AssemblyLoadContextAccessor));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PlatformServices.Default?.AssemblyLoaderContainer != null)
|
||||||
|
{
|
||||||
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.AssemblyLoaderContainer));
|
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.AssemblyLoaderContainer));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PlatformServices.Default?.LibraryManager != null)
|
||||||
|
{
|
||||||
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.LibraryManager));
|
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.LibraryManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue