You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, some of these classes are still not working. This seems to be contained only to the iOS platform when the app is submitted to App Store Connect, aka, not a simulator build. When simply instancing Random rand = new Random(); it throws an exception. This also seems to be connected to why this method- System.Text.Json.JsonSerializer.Serialize(); which comes from the System.Text.Json NuGet package also throws an exception because it gives this stack trace:
System.TypeInitializationException: The type initializer for 'System.Numerics.Hashing.HashHelpers' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Random' threw an exception. ---> System.EntryPointNotFoundException: SystemNative_GetNonCryptographicallySecureRandomBytes
Things I've tried:
Using GD.RandRange() works, but only if I set Unhandled Exception Policy to LogError instead of TerminateApplication because it somehow still throws an exception while simultaneously returning the correct data. However, this doesn't solve the System.Text.Json.JsonSerializer() issue because it still seems to rely on System.Random specifically.
I verified that System.Text.Json is compatible with net472 and net48 even though it is normally packaged with dotnet 6.0 and so on.
I used a different source generator that does not use reflection because AOT on iOS prevents execution of dynamic code so the serialization part doesn't seem like the issue related to the System.Text.Json.
So that leads me to believe that it's probably not an issue with System.Text.Json. Perhaps symbols are being stripped when it's uploaded to App Store Connect, and when something that relies on native classes are called, an exception is thrown. Unfortunately, I'm not sure how to resolve something like that.
This symbol issue could be related to these: #48701 #58454
Steps to reproduce
Create a default mono enabled project.
Use System.Random rand = new Random(); somewhere in a script.
Wrap new Random() in a try catch and set Unhandled Exception Policy to LogError from project settings to more gracefully see issue.
Export for iOS.
Upload to App Store Connect.
Download from TestFlight and run.
Alternatively, use the same steps but just use System.Text.Json.JsonSerializer.Serialize() after adding that as a NuGet package.
Make sure to change source generator from the default to metadata because of AOT restrictions on iOS.
Minimal reproduction project
N/A since described above.
The text was updated successfully, but these errors were encountered:
Please see my comment on #58454. We're experiencing something similar, and I didn't want to duplicate what I wrote here, although this issue may be an even closer match.
Godot version
v3.5.1.stable.mono.official.6fed1ffa3
System information
iOS 16.3
Issue description
This is similar to previous issues such as:
#38810
#40633
#40757
They were supposedly fixed by:
#49248
However, some of these classes are still not working. This seems to be contained only to the iOS platform when the app is submitted to App Store Connect, aka, not a simulator build. When simply instancing
Random rand = new Random();
it throws an exception. This also seems to be connected to why this method-System.Text.Json.JsonSerializer.Serialize();
which comes from theSystem.Text.Json
NuGet package also throws an exception because it gives this stack trace:System.TypeInitializationException: The type initializer for 'System.Numerics.Hashing.HashHelpers' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Random' threw an exception. ---> System.EntryPointNotFoundException: SystemNative_GetNonCryptographicallySecureRandomBytes
Things I've tried:
GD.RandRange()
works, but only if I setUnhandled Exception Policy
toLogError
instead ofTerminateApplication
because it somehow still throws an exception while simultaneously returning the correct data. However, this doesn't solve theSystem.Text.Json.JsonSerializer()
issue because it still seems to rely onSystem.Random
specifically.System.Text.Json
is compatible withnet472
andnet48
even though it is normally packaged with dotnet 6.0 and so on.System.Text.Json.
So that leads me to believe that it's probably not an issue with
System.Text.Json.
Perhaps symbols are being stripped when it's uploaded to App Store Connect, and when something that relies on native classes are called, an exception is thrown. Unfortunately, I'm not sure how to resolve something like that.This symbol issue could be related to these:
#48701
#58454
Steps to reproduce
System.Random rand = new Random();
somewhere in a script.new Random()
in atry catch
and setUnhandled Exception Policy
toLogError
from project settings to more gracefully see issue.Alternatively, use the same steps but just use
System.Text.Json.JsonSerializer.Serialize()
after adding that as a NuGet package.Make sure to change source generator from the default to metadata because of AOT restrictions on iOS.
Minimal reproduction project
N/A since described above.
The text was updated successfully, but these errors were encountered: