Switching language on Android results in a crash while navigating if resource manager used (i18n) #6732
Labels
area-controls-shell
Shell Navigation, Routes, Tabs, Flyout
p/1
Work that is important, and has been scheduled for release in this or an upcoming sprint
platform/android 🤖
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Description
Hello,
I have a MAUI app with 2 resources (ResourceManager), one FR, one EN.
It works really well with the package Microsoft.Extensions.Localization : I'm able to load the correct translation based on the user culture. I can navigate between pages, everything works great.
But if I switch the main language in Android's settings, I go back to the app (was in background while I changed the settings), I try to navigate to a new page to see if the translations are fine, it crashes. (I don't expect live changes when changing my language but at least, while navigating to a new page, I expect the correct translations to be found)
Here is the error
Java.Lang.IllegalArgumentException: 'No view found for id 0x1 (unknown) for fragment ShellItemRenderer{dd448d5} (e47cc305-1d52-4c02-9754-e65f4ffa09df id=0x1)'
No callstack, only external code
Steps to Reproduce
Create an app (I use AppShell) with 2 pages.
Add 2 resources to the project and a dependence Microsoft.Extensions.Localization package.
Don't forget to register the dependencie: builder.Services.AddLocalization();
Create a couple of key/values.
Launch the app on Android. See it works.
Go to Android settings, switch from english to the language you added in your 2nd resx.
Go back to the app, try to navigate.
Boom
Couldn't test on Windows as you have to log off to change the language.
Version with bug
Release Candidate 2 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
Android 11
Did you find any workaround?
Not yet
Relevant log output
The text was updated successfully, but these errors were encountered: