I am presently migrating a Xamarin Forms project to Maui. Within my project, there are specific requirements that vary depending on the API version, necessitating the selection of view models and data access methods. Following the login process, certain view models and data accesses must be removed, while new ones need to be registered in the ServiceCollection. This capability was previously permissible in Xamarin Forms. However, I am encountering a read-only error when attempting to add or modify services in MauiAppBuilder after the application has been built. Is there a solution to this issue? I am new to this area, so any assistance would be appreciated.
I tried to add viewmodels or services with AddSingleton methods in MauiProgram.MauiAppBuilder.Services after application build.but not working.