Fixed a crash where if a null parameter was passed

This commit is contained in:
TheXamlGuy
2024-06-22 22:47:42 +01:00
parent 4a33a1931f
commit f993e1d44b
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -24,7 +24,8 @@ public class ComponentBuilder :
services.AddScoped<IComponentHost, ComponentHost>();
services.AddScoped<IServiceFactory>(provider =>
new ServiceFactory((type, parameters) => ActivatorUtilities.CreateInstance(provider, type, parameters!)));
new ServiceFactory((type, parameters) => ActivatorUtilities.CreateInstance(provider, type,
parameters?.Where(x => x is not null).ToArray()!)));
services.AddSingleton<IDisposer, Disposer>();
+2 -1
View File
@@ -18,7 +18,8 @@ public class DefaultHostBuilder :
.ConfigureServices((context, services) =>
{
services.AddScoped<IServiceFactory>(provider =>
new ServiceFactory((type, parameters) => ActivatorUtilities.CreateInstance(provider, type, parameters!)));
new ServiceFactory((type, parameters) => ActivatorUtilities.CreateInstance(provider, type,
parameters?.Where(x => x is not null).ToArray()!)));
services.AddSingleton<IComponentHostCollection,
ComponentHostCollection>();