-
Notifications
You must be signed in to change notification settings - Fork 532
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
.NET 9.0 Preview 3 crashes SkiaSharp 3.0 in Release mode (possible ICU / Globalization problem) #9153
Comments
@mkhamoyan @matouskozak could it be that the recent HybridGlobalization changes for iOS regressed something on Android? |
I only recall this PR dotnet/runtime#98495 (not related to |
what happens if you put the following in the project file
|
Looks like the app builds and starts then just fine with .NET 9.0 Preview 3 and |
Thank you for checking it out. |
It looks like even the default .NET MAUI 9.0 project on Android does not start without |
@janne-hmp do you happen to have a smaller repro code that I could try on my machine to further investigate? I tried some small app containing:
with these packages:
that crashed in Release mode on Android (Debug working properly)
However, the failure with Globalization you were seeing I wasn't able to reproduce. I tried inserting some Globalization-related code into my program and worked correctly so I suspect the Globalization native file was loaded as expected. |
Did you finish implementing the fix? |
I did not. I tried the code I had shared earlier and I was unable to get the failure you we're reporting.
If you would have a smaller repro that I could try that would be helpful. Have you tried your app with newer previews? |
I've been able to repro every time with seemingly any MaUI project. Here's how :
You should get the mentioned Globalization crash. To note, if workloads are installed without the flags, then the behavior is a bit different. The app will run in Release, but if your project has localized resources, forcing the Culture to something else than the default language will lead to the app not launching (** Only when building on Windows, somehow on Mac it works fine **). Also, SkiaSharp is not required. |
Thank you for the info. I will investigate it more. One question:
Do you mean even MAUI apps that don't use SkiaSharp are crashing for you? |
Exactly, SkiaSharp is not required. Updated original comment. |
Sorry, I finally got time to look into it. Could you please share what MAUI version do you have ( I tried reproducing the issue as you described but installing the regular MAUI workload with Preview 5 .NET. I created an app with localized resources, changed culture: Do you have a repro app somewhere on GitHub which I could try myself? |
@matouskozak Indeed, it doesn't happen if you install the workloads normally. You need the mentioned flags for the crash to occur. If you proceed the way you did, then what happens on our end is that if you build the app for Android on Windows, not Mac, then it will crash at launch. Summary (All this applies for Preview 5, didn't try with new Preview 6): Original Crash
Follow up Crash
Both crashes are reproducible with any sample app that has localized ressources. |
Thank you, I was trying from my Mac before. I'll try from Windows machine and report the findings here... |
Regarding:
Why do you need these flags to be passed when installing workloads? In general, I think this issue is becoming confusing. Could you please create a separate issue for what you refer to as a |
For Android, we don't. But for iOS we need them otherwise our app crashes as soon as we try to display a Map. Initially, we installed the workloads the same way for iOS and Android and so after fixing the Map issue on iOS, we got this crash on Android. We now install the workloads differently for Android and iOS and we have our CI/CD run on a Mac agent to not have the localization crash on Android. Doing that, everything seems to be fine. But I still thought it would be relevant to give the information. I can create separate issues no problem. |
If I understand correctly, we have 3 different issues that you are experiencing:
Is that correct?
That would be much appreciated, thank you. |
For dotnet/runtime#2, no need for localization change, app just crashes at launch |
@SelminBiop could you please create an issue with reproduction steps for the |
I believe 852c38e has a good chance of having fixed the OP issue, however building of the repository mentioned in OP is too involved, I simply have no time to do it. @janne-hmp the above fix is going to be part of the next .NET9 rc, please test if it fixes your issue, thanks! If the issue is still there, I'm afraid we'll need a simpler repro to be able to test things locally. |
I just tried commenting out |
@janne-hmp excellent news! :) I'm going to close this issue as fixed by #9315 then |
He tested it with rc1 though. |
That’s right. It worked already in Release in RC1, so it looks like the issue has already been fixed by something else than an upcoming fix. I can try to double-check this, but I did comment out InvariantGlobalization and then hit Rebuild, and things did still work as intended. |
Description
We are developing a game called GnollHack using .NET MAUI 9.0. After upgrading to .NET 9.0 Preview 3 from 2, the game crashes immediately at start in Release mode both with SkiaSharp 3.0 Preview 2.1 and Preview 3.1. Based on logs this seems to be an ICU / Globalization problem. mattleibow from SkiaSharp repository asked me to post this to this repository.
The exception thrown is:
mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: TypeInitialization_Type, System.Globalization.CompareInfo
This comes after
monodroid-assembly: Shared library 'libSystem.Globalization.Native' not loaded, p/invoke 'GlobalizationNative_LoadICU' may fail
The logs from Android are below.
Reproduction Steps
Expected behavior
The game starts normally.
Actual behavior
The game crashes at start.
Regression?
Yes, .NET 9.0 Preview 2 worked fine.
Known Workarounds
None, have to use .NET 9.0 Preview 2
Configuration
.NET 9.0 Preview 3 / .NET MAUI 9.0 Preview 3
Android 14 (Samsung S22)
ARM64
Does not seem to depend on the phone, crashes on all phones we tried
Other information
And here's the log for .NET 9.0 Preview 3 crash:
Here's the log using Preview 2 and SkiaSharp 3.0 Preview 3.1 that also sometimes crashed in the same way. They all seem to be related.
Here's the another such log:
The text was updated successfully, but these errors were encountered: