android: [.net9-preview][android] Multiple AppResources Crash - failed to load bundled assembly pt-PT/

Description

When creating a new .net maui with VS preview and NET 9 Preview 7 with multiple AppResources the application crashes in Android on startup

D  Compat change id reported: 171228096; UID 10583; state: ENABLED
2024-08-14 07:46:51.033 19787-19787 TabLayout               com.companyname.testnet9             W  MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
2024-08-14 07:46:51.043 19787-19787 Compatibil...geReporter com.companyname.testnet9             D  Compat change id reported: 210923482; UID 10583; state: ENABLED
2024-08-14 07:46:51.054 19787-19787 monodroid-assembly      com.companyname.testnet9             W  Assembly 'pt-PT/Testnet9.resources' (hash 0x1cab5580a98905b0) not found
2024-08-14 07:46:51.054 19787-19787 monodroid-assembly      com.companyname.testnet9             W  open_from_bundles: failed to load bundled assembly pt-PT/Testnet9.resources
2024-08-14 07:46:51.054 19787-19787 monodroid-assembly      com.companyname.testnet9             W  Assembly 'pt-PT/Testnet9.resources' (hash 0x1cab5580a98905b0) not found
2024-08-14 07:46:51.054 19787-19787 monodroid-assembly      com.companyname.testnet9             W  open_from_bundles: failed to load bundled assembly pt-PT/Testnet9.resources
2024-08-14 07:46:51.057 19787-19787 monodroid-assembly      com.companyname.testnet9             A  Failed to look up image index for hash 0x7357acbda27bdba3
2024-08-14 07:46:51.057 19787-19787 monodroid               com.companyname.testnet9             A  Abort at /Users/runner/work/1/s/xamarin-android/src/native/monodroid/mono-image-loader.hh:120:5 ('static MonoImage *xamarin::android::internal::MonoImageLoader::stash_and_return(MonoImage *, MonoImageOpenStatus, hash_t)')
2024-08-14 07:46:51.058 19787-19787 libc                    com.companyname.testnet9             A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 19787 (nyname.testnet9), pid 19787 (nyname.testnet9)

Steps to Reproduce

1 - create new .net MAUI NET9 preview 7 2 - Add AppResources.resx 3 - Add AppResources.pt.resx 4 - Add Translation in a page - https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/localization?view=net-maui-8.0 4 - Run in RELEASE mode - crash

Link to public reproduction project repository

https://github.com/bcaceiro/maui9resources

Version with bug

9.0.0-preview.6.24327.7

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.80 SR8

Affected platforms

Android

Affected platform versions

33,34,35

Did you find any workaround?

Well, deleting the AppResources.pt fixes it, though loosing translations 😃

Relevant log output

--------- beginning of main
--------- beginning of system
--------- beginning of crash
2024-08-14 07:46:51.031 19787-19787 Compatibil...geReporter com.companyname.testnet9             D  Compat change id reported: 171228096; UID 10583; state: ENABLED
2024-08-14 07:46:51.033 19787-19787 TabLayout               com.companyname.testnet9             W  MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
2024-08-14 07:46:51.043 19787-19787 Compatibil...geReporter com.companyname.testnet9             D  Compat change id reported: 210923482; UID 10583; state: ENABLED
2024-08-14 07:46:51.054 19787-19787 monodroid-assembly      com.companyname.testnet9             W  Assembly 'pt-PT/Testnet9.resources' (hash 0x1cab5580a98905b0) not found
2024-08-14 07:46:51.054 19787-19787 monodroid-assembly      com.companyname.testnet9             W  open_from_bundles: failed to load bundled assembly pt-PT/Testnet9.resources
2024-08-14 07:46:51.054 19787-19787 monodroid-assembly      com.companyname.testnet9             W  Assembly 'pt-PT/Testnet9.resources' (hash 0x1cab5580a98905b0) not found
2024-08-14 07:46:51.054 19787-19787 monodroid-assembly      com.companyname.testnet9             W  open_from_bundles: failed to load bundled assembly pt-PT/Testnet9.resources
2024-08-14 07:46:51.057 19787-19787 monodroid-assembly      com.companyname.testnet9             A  Failed to look up image index for hash 0x7357acbda27bdba3
2024-08-14 07:46:51.057 19787-19787 monodroid               com.companyname.testnet9             A  Abort at /Users/runner/work/1/s/xamarin-android/src/native/monodroid/mono-image-loader.hh:120:5 ('static MonoImage *xamarin::android::internal::MonoImageLoader::stash_and_return(MonoImage *, MonoImageOpenStatus, hash_t)')
2024-08-14 07:46:51.058 19787-19787 libc                    com.companyname.testnet9             A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 19787 (nyname.testnet9), pid 19787 (nyname.testnet9)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Just tested the fix on Windows, and the app works as expected.

@dellis1972 There’s a chance c978f35e0d01df2d30e0d4a48e1f7c0156cd0e91 already fixed it, I’ll try to take a look this week.