-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Crash on startup on Android in Release when referencing a class with non ascii characters from a class library #82187
Comments
Tagging subscribers to this area: @dotnet/area-extensions-dependencyinjection Issue DetailsDescriptionI have a class Tür in a .NET 7 class library and I reference this class in a MAUI-App. When compiled in Release with AOT enabled, on an Android device, the app crashes immediatly. I am using Visual Studio 17.4.5. Installed Workload Id Manifest Version Installation Sourcemaui 7.0.59/7.0.100 SDK 7.0.200 Steps to Reproduce
Link to public reproduction project repositoryhttps://github.com/CodeAuChocolat/MauiUmlautCrash Version with bug7.0 (current) Last version that worked wellUnknown/Other Affected platformsAndroid Affected platform versionsAndroid 7, Android 12 Did you find any workaround?Rename class or disable AOT Relevant log outputTime Device Name Type PID Tag Message
02-15 10:04:07.288 CipherLab RS31 Error 18286 AndroidRuntime android.runtime.JavaProxyThrowable: System.TypeLoadException: Could not load type of field 'MauiUmlautCrash.App:_tor' (0) due to: Could not resolve type with token 01000058 from typeref (expected class 'UmlautLib.Tür' in assembly 'UmlautLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:UmlautLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:UmlautLib.Tür member:(null)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type )
at System.Collections.Concurrent.ConcurrentDictionary`2[[System.Type, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type , Func`2 )
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type , ServiceProviderEngineScope )
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type )
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider , Type )
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider )
at Microsoft.Maui.MauiApplication.OnCreate()
at Android.App.Application.n_OnCreate(IntPtr , IntPtr )
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5503)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
from settings cache , name = dropbox:data_app_crash , value = null
from settings cache , name = send_action_app_error , value = 1
from settings cache , name = logcat_for_data_app_crash , value = null
Force finishing activity com.companyname.mauiumlautcrash/crc642a249426a1f98bd8.MainActivity
from settings cache , name = dropbox:data_app_crash , value = null
from settings cache , name = dropbox_age_seconds , value = null
from settings cache , name = dropbox_max_files , value = null
from settings cache , name = dropbox_quota_percent , value = null
from settings cache , name = dropbox_reserve_percent , value = null
from settings cache , name = dropbox_quota_kb , value = null
|
Based on above this looks like an AOT issue with non-ascii characters used in a type name. |
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsDescriptionI have a class Tür in a .NET 7 class library and I reference this class in a MAUI-App. When compiled in Release with AOT enabled, on an Android device, the app crashes immediatly. I am using Visual Studio 17.4.5. Installed Workload Id Manifest Version Installation Sourcemaui 7.0.59/7.0.100 SDK 7.0.200 Steps to Reproduce
Link to public reproduction project repositoryhttps://github.com/CodeAuChocolat/MauiUmlautCrash Version with bug7.0 (current) Last version that worked wellUnknown/Other Affected platformsAndroid Affected platform versionsAndroid 7, Android 12 Did you find any workaround?Rename class or disable AOT Relevant log outputTime Device Name Type PID Tag Message
02-15 10:04:07.288 CipherLab RS31 Error 18286 AndroidRuntime android.runtime.JavaProxyThrowable: System.TypeLoadException: Could not load type of field 'MauiUmlautCrash.App:_tor' (0) due to: Could not resolve type with token 01000058 from typeref (expected class 'UmlautLib.Tür' in assembly 'UmlautLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:UmlautLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:UmlautLib.Tür member:(null)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type )
at System.Collections.Concurrent.ConcurrentDictionary`2[[System.Type, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type , Func`2 )
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type , ServiceProviderEngineScope )
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type )
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider , Type )
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider )
at Microsoft.Maui.MauiApplication.OnCreate()
at Android.App.Application.n_OnCreate(IntPtr , IntPtr )
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5503)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
from settings cache , name = dropbox:data_app_crash , value = null
from settings cache , name = send_action_app_error , value = 1
from settings cache , name = logcat_for_data_app_crash , value = null
Force finishing activity com.companyname.mauiumlautcrash/crc642a249426a1f98bd8.MainActivity
from settings cache , name = dropbox:data_app_crash , value = null
from settings cache , name = dropbox_age_seconds , value = null
from settings cache , name = dropbox_max_files , value = null
from settings cache , name = dropbox_quota_percent , value = null
from settings cache , name = dropbox_reserve_percent , value = null
from settings cache , name = dropbox_quota_kb , value = null
|
Tagging subscribers to 'arch-android': @steveisok, @akoeplinger Issue DetailsDescriptionI have a class Tür in a .NET 7 class library and I reference this class in a MAUI-App. When compiled in Release with AOT enabled, on an Android device, the app crashes immediatly. I am using Visual Studio 17.4.5. Installed Workload Id Manifest Version Installation Sourcemaui 7.0.59/7.0.100 SDK 7.0.200 Steps to Reproduce
Link to public reproduction project repositoryhttps://github.com/CodeAuChocolat/MauiUmlautCrash Version with bug7.0 (current) Last version that worked wellUnknown/Other Affected platformsAndroid Affected platform versionsAndroid 7, Android 12 Did you find any workaround?Rename class or disable AOT Relevant log outputTime Device Name Type PID Tag Message
02-15 10:04:07.288 CipherLab RS31 Error 18286 AndroidRuntime android.runtime.JavaProxyThrowable: System.TypeLoadException: Could not load type of field 'MauiUmlautCrash.App:_tor' (0) due to: Could not resolve type with token 01000058 from typeref (expected class 'UmlautLib.Tür' in assembly 'UmlautLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') assembly:UmlautLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:UmlautLib.Tür member:(null)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type )
at System.Collections.Concurrent.ConcurrentDictionary`2[[System.Type, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type , Func`2 )
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type , ServiceProviderEngineScope )
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type )
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider , Type )
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider )
at Microsoft.Maui.MauiApplication.OnCreate()
at Android.App.Application.n_OnCreate(IntPtr , IntPtr )
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
at crc6488302ad6e9e4df1a.MauiApplication.n_onCreate(Native Method)
at crc6488302ad6e9e4df1a.MauiApplication.onCreate(MauiApplication.java:28)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5503)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
from settings cache , name = dropbox:data_app_crash , value = null
from settings cache , name = send_action_app_error , value = 1
from settings cache , name = logcat_for_data_app_crash , value = null
Force finishing activity com.companyname.mauiumlautcrash/crc642a249426a1f98bd8.MainActivity
from settings cache , name = dropbox:data_app_crash , value = null
from settings cache , name = dropbox_age_seconds , value = null
from settings cache , name = dropbox_max_files , value = null
from settings cache , name = dropbox_quota_percent , value = null
from settings cache , name = dropbox_reserve_percent , value = null
from settings cache , name = dropbox_quota_kb , value = null
|
/cc @SamMonoRT |
Is the trimmer running when we build for Android in Release mode for devices? Maybe it removed |
I can repro with a Release build running on an arm64 emulator on an arm64 mac. A colleague couldn't repro with an x64 android emulator. somehow it's arch-specific?? |
I don't think it's a trimmer issue. afaict the trimmer didn't change the assembly. Usually these class setup errors come from the class loader, but I really don't get why the class loader would care about the architecture. We do cache some class info in the AOT data, which could affect startup on AOT. But I didn't think the backend for that was arch-specific... |
Possible dupe of #78638 |
One place where the AOT compiler and class names interact is in But:
|
It's definitely the AOT name cache. if I hack I don't really want to check-in the fallback, though - this should be a cache hit. Next step is to instrument the AOT compiler and AOT runtime and compare the hash codes going into the table and the hash codes that are looked up. |
Oh god... it is some signed vs unsigned
This is what the android device is trying to look up
This is the hash implementation guint
mono_metadata_str_hash (gconstpointer v1)
{
/* Same as g_str_hash () in glib */
char *p = (char *) v1;
guint hash = *p;
while (*p++) {
if (*p)
hash = (hash << 5) - hash + *p;
}
return hash;
} UTF-8 continuation bytes have the top bit set, so if |
The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes dotnet#82187 Fixes dotnet#78638
The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes #82187 Fixes #78638
The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes dotnet/runtime#82187 Fixes dotnet/runtime#78638
The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes dotnet/runtime#82187 Fixes dotnet/runtime#78638
Backport of dotnet/runtime#83273 to mono/mono `main` The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Contributes to dotnet/runtime#82187 Contributes to dotnet/runtime#78638
Backport of dotnet/runtime#83273 to mono/mono `2020-02` The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Contributes to dotnet/runtime#82187 Contributes to dotnet/runtime#78638
* [mono] Use `unsigned char` when computing UTF8 string hashes The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes #82187 Fixes #78638 * [aot] add DEBUG_AOT_NAME_TABLE code for debugging the class names AOT compiler: Emits a second "class_name_table_debug" symbol that has all the class names and hashes as strings. AOT runtime: warns if a class is not found in the name cache * Add regression test
The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes #82187 Fixes #78638
The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes dotnet#82187 Fixes dotnet#78638
…hes (#83303) * [mono] Use `unsigned char` when computing UTF8 string hashes The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes #82187 Fixes #78638 * Add regression test --------- Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
…es (#83302) * [mono] Use `unsigned char` when computing UTF8 string hashes The C standard does not specify whether `char` is signed or unsigned, it is implementation defined. Apparently Android aarch64 makes a different choice than other platforms (at least macOS arm64 and Windows x64 give different results). Mono uses `mono_metadata_str_hash` in the AOT compiler and AOT runtime to optimize class name lookup. As a result, classes whose names include UTF-8 continuation bytes (with the high bit = 1) will hash differently in the AOT compiler and on the device. Fixes #82187 Fixes #78638 * Add regression test
Description
I have a class Tür in a .NET 7 class library and I reference this class in a MAUI-App. When compiled in Release with AOT enabled, on an Android device, the app crashes immediatly.
Works on Windows.
Works on Android Emulator
I am using Visual Studio 17.4.5.
Installed Workload Id Manifest Version Installation Source
maui 7.0.59/7.0.100 SDK 7.0.200
Steps to Reproduce
Link to public reproduction project repository
https://github.com/CodeAuChocolat/MauiUmlautCrash
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 7, Android 12
Did you find any workaround?
Rename class or disable AOT
Relevant log output
The text was updated successfully, but these errors were encountered: