Skip to content
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

Mono iOS Deploy - System.EntryPointNotFoundException for SystemNative_GetNonCryptographicallySecureRandomBytes #38810

Closed
DavidJVitale opened this issue May 17, 2020 · 6 comments

Comments

@DavidJVitale
Copy link

Godot version:
3.2.2-beta2-mono

OS/device including version:
OSX 10.15.4
XCode 11.4.1
iPhone 8, iOS 13.4.1

Issue description:
Deploying a Mono C# project on iOS with 3.2.2 works fine in the simulator, fails on real device deploy when you "Archive" the project and deploy on physical iOS device via Ad hoc distribution of an .ipa file. The application display the loading image, then crashes immediately with this unhandled exception of an apparent linking error:

May 17 14:02:26 Davids-iPhone DodgetheCreeps[22461] <Notice>:                   
Unhandled Exception:                                                            
System.TypeInitializationException: The type initializer for 'System.Random' threw an exception. ---> System.EntryPointNotFoundException: SystemNative_GetNonCryptographicallySecureRandomBytes
  at Interop.GetRandomBytes (System.Byte* buffer, System.Int32 length) [0x00000] in <e8ca3a82b1c44b21ba65f40b11f07643>:0 
  at System.Random.GenerateGlobalSeed () [0x00000] in <e8ca3a82b1c44b21ba65f40b11f07643>:0 
  at System.Random..cctor () [0x00000] in <e8ca3a82b1c44b21ba65f40b11f07643>:0  
   --- End of inner exception stack trace ---                                   
  at Main..ctor () [0x00000] in <928693da75cb4a549db27400f3bb9797>:0            

This is reproducible on my personal Godot project, as well as the public sample of "Dodge the Creeps".

Relevant logs:

Archive Build Log
idevicesyslog output during crash (I build in cloud and deploy local, so unfortunately no access to USB debugging in xCode...)

Steps to reproduce:

  1. Using the "Dodge The Creeps" Mono demo project, Export for iOS. Fill in Apple Team ID, identifier, 120x120 icon, etc.
  2. Open the exported project in XCode. Optionally run in simulator to assert that it works there. Change device to Build Only Device of DodgeTheCreeps > Generic iOS Device, select Build > Archive, like his:
    • remmina_screenshot-2020-5-17-20:27:19 070641
  3. Press "Distribute App" then "Ad hoc distribution"
    • remmina_screenshot-2020-5-17-20:27:53 366171
    • Make sure you authenticate to Apple in XCode and have added your device udid in apple developer settings
  4. Finish off the distribution process to get your outputed DodgeTheCreeps.ipa file. Deploy to your physical iOS device
    • I did this with libimobiledevice software by running ideviceinstaller -i /path/to/DodgeTheCreeps.ipa
  5. After the app installs on your physical iOS device, open the app. You should see the loading screen, then an immediate crash.
    • I parsed captured logs with idevicesyslog

Minimal reproduction project:
https://github.com/godotengine/godot-demo-projects/tree/master/mono/dodge_the_creeps with the above steps

@neikeq neikeq self-assigned this May 17, 2020
@neikeq neikeq added this to the 4.0 milestone May 17, 2020
@DavidJVitale
Copy link
Author

FYI, just tested again with 3.2.2-beta3--I'm getting the same result with that as well.

@DavidJVitale
Copy link
Author

Just tested again with 3.2.2-rc1--same result

@neikeq
Copy link
Contributor

neikeq commented Jul 31, 2020

For reference, #40633 also includes an example project for reproducing this issue.

@andy-noisyduck
Copy link
Contributor

So its documented, Random is used by ThreadPool.QueueSegment internally, and so you can end up running into this when using Tasks (e.g. Task.Delay will throw this exception for me).

@7sDream
Copy link

7sDream commented Feb 9, 2021

Reproduce this when export for macOS too, at version v3.2.3.stable.mono.official.

Xnip2021-02-09_17-47-42

@neikeq
Copy link
Contributor

neikeq commented May 16, 2021

This was created first but I'm going to close it as duplicate of #40757 because discussion has developed more there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants