-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Using most System.IO file classes will crash on iOS devices (not in the simulator) #40757
Comments
I can't reproduce the crash with newly downloaded Godot and newly exported project. Tested on iPhone 6 (iOS 12) and iPhone XS (iOS 13). |
Interesting. Which Mono version have you built with? |
I didn't install any specific version of Mono or specified anything specific to it in Xcode project. Well, I have a mono that got installed with
|
Is it not? My understanding is that the Mono assemblies that get bundled with your app (including System and mscorlib) are the ones from your local Mono distribution. The export template only contains the precompiled The broken
By coincidence, I ended up with a fresh Mac today. I tried a new install with the setup you described (Godot 3.2.2, Mono 5.16.0.220, and latest Xcode). I still get a crash on the device under this scenario (but again, not in the simulator). I am unsure why we are getting different results. |
I think it's not, because resulting Xcode project does not have any additional rules for compilation or asset bundling other than just statically linking five Maybe running iOS app with |
I'm also not sure why we are having different results, but maybe you can try using Xcode project that I've exported: |
My understanding is that the .Net assemblies are run through AoT and then built into a static library that Xcode then uses in the build (
Perfect. I was going to ask if you would mind putting your project up for me to try. Thanks for helping investigate this. |
Your project crashes on my device (with the same exception from the ticket). I didn't expect that result, and I am not sure where to go from here. |
Ok, I think I've managed to break the project :)
|
@andy-noisyduck try this build. I've enabled all options in Godot under Test-MonoFileIOS_edited.zip |
I get the exception again on my device. I'm going to try and get hold of a different device over the weekend. I want to rule out having an odd device somehow. |
Try to enable the options and make a clean export yourself. And don't forget to clean |
Most of the
Out of curiosity, I just tried the build on an AWS Device Farm iPhone, and I also get the exception there (with either your project or mine). I'll still try and get another physical device over the weekend and I'll grab the logs from it. Not sure how else to narrow this down. It would also be interesting if a 3rd person could build the project and see what results they get. |
If you would be able to give a logs from console, that could help too. After I've changed project settings my logs look like this:
|
This looks similar to #38810, but a part of the exception message seems to be missing in your error message. The error suggests these symbols are being stripped by the linker. godot/modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs Lines 364 to 369 in 9adf6d3
I don't know if this is the reason it isn't working for some people. You could try adding -u _SystemNative_Stat2 to Other Linker Flags in Xcode and check if that fixes it or if the symbol in the exception is a different one.
No, the official Godot builds bundle their own Mono assemblies in the export templates. The Mono distribution in your system should have no effect on exported games. |
I get the same exception with the extra linker params.
This is when archiving for deployment. I sign the app for Ad-Hoc then run on the appropriate device.
That is genuinely the exception message. It just says |
This week I was finally able to give this a try (I got an M1 last year but couldn't get my builds working until now) and I managed to reproduce the issue.
So in order to fix the issue what I need to do is:
|
If any one wants to test, the fixes can be found in this branch, but they cannot be merged yet until #45480 is added back (it was temporarily reverted) and #45499 is merged. My branch has those two PRs cherry-picked for testing. |
I don't know if this is relevant, but I have an iOS app that only crashes in Achived-> Ad Hoc mode, so it will run on my devices, but not pass Apple review. It seems the reason is it's using C#'s native Random . I'm swapping it out for GD.Random, and that fixes the problem. |
Fixed by #49248. @Difference That should be the same issue, so it should be fixed in the next release. |
Godot version:
3.2.2 Mono w/ Mono 6.10 stable
OS/device including version:
Build w/ OSX Catalina, tested on various iPhones w/ iOS 13
Issue description:
App will crash when using most of the System.IO classes, such as File or FileStream. This only happens on real devices. The simulator works fine.
The crash occurs any time the framework needs to call the native
Stat
method to check if a file exists (and most of the File classes do this on creation to know whether to overwrite, append, or throw depending on modes passed).As with #40633, I am unsure whether this is a problem with the way Godot is using Mono, a symptom of AoT (required for iOS), or a problem with the Mono implementation on iOS. I am starting to think it's related and that's its a linking or packaging problem for native methods on iOS.
It's not clear to me which versions of libmono get packed if your local Mono install doesn't match the pre-compiled export template (in my case 6.10 vs 6.8). I also tried this matching my local Mono version to the template. The issue still occurred.
Steps to reproduce:
new FileStream(Path.Combine(".test"), FileMode.OpenOrCreate);
Minimal reproduction project:
Test-MonoFileIOS.zip
The text was updated successfully, but these errors were encountered: