CommunityToolkit / CommunityToolkit/MVVM-Samples
Null exception on Ioc.Default.ConfigureServices on Android after return from OnDestroy
- Dominant language
- No language data
- Stars
- 1.4k
- Forks
- 265
- PR merge metrics
- No merged PRs in 30d
Description
System.InvalidOperationException: The default service provider has already been configured
at Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.ThrowInvalidOperationExceptionForRepeatedConfiguration () [0x00000] in /_/Microsoft.Toolkit.Mvvm/DependencyInjection/Ioc.cs:164
at Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.ConfigureServices (System.IServiceProvider serviceProvider) [0x0000f] in /_/Microsoft.Toolkit.Mvvm/DependencyInjection/Ioc.cs:139
at CSLightsMVVM.App..ctor () [0x00009] in C:\Users\Tom\source\repos\CSLightsMVVM\CSLightsMVVM\CSLightsMVVM\App.xaml.cs:29
The problem is that Ioc.Default object is instantiated itself and apparently not destroyed after MainActivity.OnDestroy() is called. Then, when user return app from stack, App ctor is run again and there no way to check if Ioc.Default had been already configured or not.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.