From 899eb64aad503890d999cc537a62599d73cd8630 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Wed, 3 Jan 2024 20:53:51 -0600 Subject: [PATCH] chore: removing FinalizeExtension --- src/Forms/Prism.Forms/PrismApplicationBase.cs | 4 +--- src/Maui/Prism.Maui/PrismAppBuilder.cs | 10 +++++----- src/Uno/Prism.Uno/PrismApplicationBase.cs | 1 - src/Wpf/Prism.Wpf/PrismApplicationBase.cs | 1 - src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs | 1 - .../Fixtures/Ioc/ContainerProviderExtensionFixture.cs | 1 - 6 files changed, 6 insertions(+), 12 deletions(-) mode change 100755 => 100644 src/Uno/Prism.Uno/PrismApplicationBase.cs diff --git a/src/Forms/Prism.Forms/PrismApplicationBase.cs b/src/Forms/Prism.Forms/PrismApplicationBase.cs index 3af9466821..b17b8d71c6 100644 --- a/src/Forms/Prism.Forms/PrismApplicationBase.cs +++ b/src/Forms/Prism.Forms/PrismApplicationBase.cs @@ -102,7 +102,7 @@ protected virtual void ConfigureViewModelLocator() { ViewModelLocationProvider.SetDefaultViewModelFactory((view, type) => { - List<(Type Type, object Instance)> overrides = new List<(Type, object)>(); + List<(Type Type, object Instance)> overrides = []; if (Container.IsRegistered()) { var resolver = Container.Resolve(); @@ -148,8 +148,6 @@ protected virtual void Initialize() PlatformInitializer?.RegisterTypes(_containerExtension); RegisterTypes(_containerExtension); - _containerExtension.FinalizeExtension(); - _moduleCatalog = Container.Resolve(); ConfigureModuleCatalog(_moduleCatalog); } diff --git a/src/Maui/Prism.Maui/PrismAppBuilder.cs b/src/Maui/Prism.Maui/PrismAppBuilder.cs index 7a2143e6d8..ccf6eab6f6 100644 --- a/src/Maui/Prism.Maui/PrismAppBuilder.cs +++ b/src/Maui/Prism.Maui/PrismAppBuilder.cs @@ -27,12 +27,12 @@ public sealed class PrismAppBuilder internal PrismAppBuilder(IContainerExtension containerExtension, MauiAppBuilder builder) { - if (containerExtension is null) - throw new ArgumentNullException(nameof(containerExtension)); + ArgumentNullException.ThrowIfNull(containerExtension); + ArgumentNullException.ThrowIfNull(builder); _container = containerExtension; - _registrations = new List>(); - _initializations = new List>(); + _registrations = []; + _initializations = []; ViewModelCreationException.SetViewNameDelegate(view => { @@ -89,7 +89,7 @@ internal PrismAppBuilder(IContainerExtension containerExtension, MauiAppBuilder /// public MauiAppBuilder MauiBuilder { get; } - private void ConfigureViewModelLocator() + private static void ConfigureViewModelLocator() { ViewModelLocationProvider.SetDefaultViewToViewModelTypeResolver(view => { diff --git a/src/Uno/Prism.Uno/PrismApplicationBase.cs b/src/Uno/Prism.Uno/PrismApplicationBase.cs old mode 100755 new mode 100644 index 71dba9e1a7..74b2e47eef --- a/src/Uno/Prism.Uno/PrismApplicationBase.cs +++ b/src/Uno/Prism.Uno/PrismApplicationBase.cs @@ -126,7 +126,6 @@ protected virtual void Initialize(IApplicationBuilder builder) _containerExtension.RegisterInstance(builder.Window); RegisterRequiredTypes(_containerExtension); RegisterTypes(_containerExtension); - _containerExtension.FinalizeExtension(); ConfigureModuleCatalog(Container.Resolve()); diff --git a/src/Wpf/Prism.Wpf/PrismApplicationBase.cs b/src/Wpf/Prism.Wpf/PrismApplicationBase.cs index ce6a615f24..86954c2772 100644 --- a/src/Wpf/Prism.Wpf/PrismApplicationBase.cs +++ b/src/Wpf/Prism.Wpf/PrismApplicationBase.cs @@ -61,7 +61,6 @@ protected virtual void Initialize() _moduleCatalog = CreateModuleCatalog(); RegisterRequiredTypes(_containerExtension); RegisterTypes(_containerExtension); - _containerExtension.FinalizeExtension(); ConfigureModuleCatalog(_moduleCatalog); diff --git a/src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs b/src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs index e1d9cc386d..5cb14eaef0 100644 --- a/src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs +++ b/src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs @@ -58,7 +58,6 @@ protected virtual void Initialize() _moduleCatalog = CreateModuleCatalog(); RegisterRequiredTypes(_containerExtension); RegisterTypes(_containerExtension); - _containerExtension.FinalizeExtension(); ConfigureModuleCatalog(_moduleCatalog); diff --git a/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Ioc/ContainerProviderExtensionFixture.cs b/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Ioc/ContainerProviderExtensionFixture.cs index 57a35cb5ab..720c5a6197 100644 --- a/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Ioc/ContainerProviderExtensionFixture.cs +++ b/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Ioc/ContainerProviderExtensionFixture.cs @@ -36,7 +36,6 @@ static ContainerProviderExtensionFixture() { _containerExtension.RegisterInstance(kvp.Value, kvp.Key); } - _containerExtension.FinalizeExtension(); } public ContainerProviderExtensionFixture()