-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[.net9-preview][android] Multiple AppResources Crash - failed to load bundled assembly pt-PT/ #9200
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! Open similar issues:
Closed similar issues:
|
@bcaceiro If you try this in a .NET Android application that doesn't implement the MAUI UI framework ( |
@drasticactions no idea, tbf not quite familiar with AppResources in a dotnet android app |
I tried to repo and Preview 6 of .net 9 and I am unable to do so. I tested both |
@dellis1972 - It is on preview7 - the template doesn't have that option available. I have a reproduction link in the issue. Tested on a real device though |
So I can't repo on device or emulator using preview 7. @grendello can you take a look when you get a moment? |
Changed the description of the reproduction steps - It only happens in RELEASE mode |
Any update? |
@grendello when you get a moment can you take a look at this one? |
@dellis1972 There's a chance c978f35 already fixed it, I'll try to take a look this week. |
This is still happening in net9-rc1. |
@grendello: this appears to be due to some difference between Windows and non-Windows host platform builds (?!). Repro steps:
When I build from macOS, the When I build from Windows, the
|
Further trying to narrow down how (why?!!!!) macOS and Windows builds would differ, I narrow down upon diff -ubi obj/Release/net9.0-android/android/marshal_methods.arm64-v8a.ll windows/marshal_methods.arm64-v8a.ll | grep -i 'pt.*testnet9' Reordered so that things go together: --- obj/Release/net9.0-android/android/marshal_methods.arm64-v8a.ll 2024-09-19 11:17:56
+++ windows/marshal_methods.arm64-v8a.ll 2024-09-19 15:07:55
@@ -21,225 +21,225 @@
- i64 u0x0b3684b793a1337f, ; 19: pt/Testnet9.resources.dll => 0
+ i64 u0x0b3684b793a1337f, ; 16: pt/Testnet9.resources.dll => 0
- i64 u0x4a77e791b1c18aa8, ; 91: lib-pt-Testnet9.resources.dll.so => 0
+ i64 u0x4a77e791b1c18aa8, ; 94: lib-pt-Testnet9.resources.dll.so => 0
- i64 u0x7357acbda27bdba3, ; 158: pt/Testnet9.resources => 0
+ i64 u0xd0b0f3f98144eece, ; 285: pt\Testnet9.resources => 0 Note that above is LLVM-IR.
Things that stick out to me:
Additionally, from the crash log:
Hash 0x7357acbda27bdba3 is present on the macOS build, but not Windows, apparently because of the directory separator character: - i64 u0x7357acbda27bdba3, ; 158: pt/Testnet9.resources => 0
+ i64 u0xd0b0f3f98144eece, ; 285: pt\Testnet9.resources => 0 |
@grendello: I think we need at least: diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/MarshalMethodsNativeAssemblyGenerator.cs b/src/Xamarin.Android.Build.Tasks/Utilities/MarshalMethodsNativeAssemblyGenerator.cs
index 46faa8d74..e268ee628 100644
--- a/src/Xamarin.Android.Build.Tasks/Utilities/MarshalMethodsNativeAssemblyGenerator.cs
+++ b/src/Xamarin.Android.Build.Tasks/Utilities/MarshalMethodsNativeAssemblyGenerator.cs
@@ -986,7 +986,8 @@ namespace Xamarin.Android.Tasks
foreach (string name in uniqueAssemblyNames) {
// We must make sure we keep the possible culture prefix, which will be treated as "directory" path here
string cultureName = Path.GetDirectoryName (name) ?? String.Empty;
- string clippedName = Path.Combine (cultureName, Path.GetFileNameWithoutExtension (name));
+ string clippedName = Path.Combine (cultureName, Path.GetFileNameWithoutExtension (name))
+ .Replace (@"\", "/");
string inArchiveName;
if (cultureName.Length == 0) { |
Fixes: #9200 @jonpryor found that on Windows, shared library name hashes are generated using the Windows path separator character, while the runtime expects a Unix one. This discrepancy leads to different hashes for the same satellite assembly on Linux/macOS and Windows. Fix by explicitly converting any `\` characters in the satellite assembly name to `/` prior to hash generation.
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
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
The text was updated successfully, but these errors were encountered: