Skip to content

[regression/6.0.312] Infinite recursion during resource lookup within System.Private.CoreLib #7745

@Eilon

Description

@Eilon

Issue moved from dotnet/maui#12826


From @SmartmanApps on Sunday, January 22, 2023 6:58:23 AM

Description

Hello. This is actually an issue with System.Private.Corelib that I have run into with MAUI on an Android physical device, but I'm not sure how to raise an issue with whoever looks after that (I know how to raise a MAUI issue, and a Visual Studio issue, but not a System.Private.Corelib issue). I'm hoping you know who to refer this to and/or can implement a fix/workaround into MAUI csproj (e.g. I see there's now a fix in the MAUI csproj for the Android "fast deployment" issue - yay for finally having a fix for that! :-) ).

So with some research and testing, here's the issue - "Infinite recursion during resource lookup within System.Private.CoreLib" will SOMETIMES happen if the Android device isn't set to English (U.S.) - I've run into this on a physical device, but I can't find where to change the language on my emulator (I'm presuming the emulator is set to U.S.). I'm in Australia and my device is normally set to English (U.K.), which is how I ended up running into the issue (note: I've tried this on both Android and Windows, but not any other platforms - only happens on Android so far). I only found the work-around (it's a work-around, not a fix) when someone whose device was set to Lithuanian ran into it (and fixed it by setting to U.S.) - https://stackoverflow.com/questions/71792563/net-maui-application-fails-to-launch-on-local-arm64-v8a-device - the answer in there about adding something to the csproj didn't fix it for me, so still looking for a proper fix (can't ship an app that only works in U.S.).

I have 2 other MAUI apps that don't run into this, but they are small. The app I'm experiencing this with uses 20-odd libraries (my own libraries, not nugets), and I don't know yet which library is causing the issue. I haven't intentionally put any localisation in yet, but as per https://stackoverflow.com/questions/48868767/c-sharp-infinite-recursion-during-resource-lookup it could be something as simple as creating a file.

I'm hoping someone there can track down where this issue is and put in a proper fix for it (or provide a work-around other than setting the device to U.S., which is the only thing I've found so far that works).

Steps to Reproduce

Note: the attached repro isn't a repro at all, but you wouldn't let me submit this issue without one. I'm still trying to get it to repro in something that I can share publicly (and I'll let you know if I do).

  1. Create a MAUI app
  2. use a MAUI library with it
  3. have your Android device set to a non-U.S. language
  4. It's just (bad) luck if you run into it. Repeat step 2 until you do. I have 3 MAUI apps, and it only happens with one, the one with the most libraries in it, and the one I can't really share (but I can maybe share some parts of it with you privately if needed).

The only info I can add there is the last thing I saw it successfully do (via my writelines) was use Preferences.Get(). It's hard to say what it did next as multiple constructors are running at once (so non-sequential), and I didn't get an exception - the app just crashes (so no call stack). Happy to do further diagnostics if you tell me what you want me to try (like a particular Visual Studio debug setting or whatever).

Link to public reproduction project repository

https://github.com/SmartmanApps/MauiLib1.git

Version with bug

6.0.312

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 6 (and up?)

Did you find any workaround?

Set device language to U.S.

Relevant log output

Same error, but 2 different error messages (at different times)...

[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[] Process terminated.
[] Encountered infinite recursion while looking up resource 'IO_FileName_Name' in System.Private.CoreLib. Verify the installation of .NET is complete and does not need repairing, and that the state of the process has not become corrupted.
[libc] Fatal signal 6 (SIGABRT), code -6 in tid 22578 (manApps.redacted)


[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[monodroid-assembly] open_from_bundles: failed to load assembly en-GB/System.Private.CoreLib.resources.dll
[] Process terminated due to "Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: IO_FileName_Name"
[libc] Fatal signal 6 (SIGABRT), code -6 in tid 28717 (manApps.redacted)

Metadata

Metadata

Labels

need-attentionA xamarin-android contributor needs to review

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions