After using the MAUI app for a certain period of time (periods ranging from a few hours to a week and a half based on the tests conducted), the program throws an exception due to an internal dependency injection issue (No service for type 'Microsoft.Maui.Platform.NavigationRootManager' has been registered.).
The error is thrown at random while calling the "PushModalAsync" method on INavigation,
Example // on MainPage:
MainThread.BeginInvokeOnMainThread(async () =>
{
var modalNav = new FormModal(message);
await this.Navigation.PushModalAsync(modalNav);
}
Sometimes we can run the PushModalAsync method for weeks before seeing the error, sometimes it happens in two hours.
About the App:
The application is designed to collect data from the production line in real time, which implies constant activity and the need to maintain stability over long periods of operation.
Notes
The computer's resources are healthy at the time of the error. There is no indication of resource shortages, neither in terms of CPU nor memory.
This happens more often in computers with W10.
We don't have a Shell.
The page is not running on a NavigationPage. Our app start looks like this:
public App(IServiceProvider provider)
{
this.InitializeComponent();
this.MainPage = new MainPage();
}
Steps to Reproduce
It is difficult to reproduce because the error occurs when the application has been running for a considerable amount of time.
On a PC with a 13th-generation i7 processor, the bug was impossible for me to reproduce. The error occurs on a computer with a 7th-generation i7 processor and 16GB RAM.
You can try
Create a new MAUI App
Do a simple set up like in the description.
Create 1 modal or two , and call PushModalAsync until the exception is thrown.
Link to public reproduction project repository
No response
Version with bug
8.0.83 SR8.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
Windows
Affected platform versions
windows10.0.19041.0
Did you find any workaround?
No response
Relevant log output
No service for type 'Microsoft.Maui.Platform.NavigationRootManager' has been registered. Stacktrace: at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) Frame:GetRequiredService at offset 18622385 in file:line:column <filename unknown>:0:0
One or more errors occurred. (No service for type 'Microsoft.Maui.Platform.NavigationRootManager' has been registered.) Stacktrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) Frame:ThrowIfExceptional at offset 54 in file:line:column <filename unknown>:0:0
Description
After using the MAUI app for a certain period of time (periods ranging from a few hours to a week and a half based on the tests conducted), the program throws an exception due to an internal dependency injection issue (No service for type 'Microsoft.Maui.Platform.NavigationRootManager' has been registered.).
Our MauiProgram.cs CreateMAUI APP method:
The error is thrown at random while calling the "PushModalAsync" method on INavigation,
Example // on MainPage:
Sometimes we can run the PushModalAsync method for weeks before seeing the error, sometimes it happens in two hours.
About the App:
The application is designed to collect data from the production line in real time, which implies constant activity and the need to maintain stability over long periods of operation.
Notes
The computer's resources are healthy at the time of the error. There is no indication of resource shortages, neither in terms of CPU nor memory. This happens more often in computers with W10. We don't have a Shell. The page is not running on a NavigationPage. Our app start looks like this:
Steps to Reproduce
It is difficult to reproduce because the error occurs when the application has been running for a considerable amount of time.
On a PC with a 13th-generation i7 processor, the bug was impossible for me to reproduce. The error occurs on a computer with a 7th-generation i7 processor and 16GB RAM.
You can try
Link to public reproduction project repository
No response
Version with bug
8.0.83 SR8.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
Windows
Affected platform versions
windows10.0.19041.0
Did you find any workaround?
No response
Relevant log output