-
Notifications
You must be signed in to change notification settings - Fork 516
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
Random app crashes on publish in AOT mode #21908
Comments
From @mattleibow on Sat, 04 Jan 2025 14:18:54 GMT @rolfbjarne thoughts? |
From @mattleibow on Sat, 04 Jan 2025 14:22:56 GMT @jdarwood007 not sure if it matters, but are you using the interpreter? Have you set the |
From @mattleibow on Sat, 04 Jan 2025 14:24:32 GMT I found these issues:
Might be unrelated, might not be. |
From @jdarwood007 on Sat, 04 Jan 2025 15:44:23 GMT @mattleibow I do not have it defined in my .csproj, so no. Although a quick read on the documentation seems that this may be the reason because I use generics. I consume a REST API returning JSON results and it uses a standardized return with a property that has a defined type (so my return is something like I did enable However, I can get it to build and run successfully randomly and even have releases. My thoughts here are that something on the Visual Studio or Mac OS side is being held and retained during the build from a previous build and causing this. It is possible that a file is being cached improperly, a file stat call is returning cached results or a file is not recognized as needing to be rebuilt. For the linked issues, the first issue mentions The second issue was resolved with an update, but the change message indicates a different function than the one I'm seeing crashing. That is we are seeing The third linked issue isn't relevant, as their crash is caused by code they directly wrote, whereas from what I can tell, my issue occurs early on in the startup process, before my code can even execute. |
Yes, this certainly looks like a problem with incremental builds, where we don't correctly identify what needs to be rebuilt and what doesn't (which is why a clean build works: then everything will be rebuilt). The annoying part here is that these incremental build issues can be rather hard to track down, because we need very specific instructions in order to reproduce them: provide a test project (or your actual project if that's easier for you), and then something like:
|
The app is an internal app used for the business. I tested on another of our internal apps, currently on .net 8, and even after upgrading to .net 9 and doing testing, it worked flawlessly. Yet the first app (in this report) gave me trouble for weeks with random crashes. I even tried to mess with various build settings to determine if it was something during the linker doing something and accidentally stripping out a needed component. Unfortunately, building in dev and release mode has worked fine for the past week now. I don't have a build to send to test flight to verify if its still doing it. Oddly enough though, when I would build for release, it would sometimes work, but then sending it up to testflight and back down to the device would crash. Are there additional debugging steps I can try to do in order to produce more verbose information? Can I get the compiler to indicate what libraries/components it determines will not need to be updated and thus are skipped in the build output log? I don't see any from the output myself. |
Any problems with the linker would be consistent - i.e. cleaning wouldn't fix it.
Kind of, if you get an MSBuild binlog (https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#binary-build-logs), it will typically be possible to deduce this by inspecting the binlog. However, the build process is rather complex, so it's not trivial. If you can get such a binlog, we could have a look and see if we find anything useful (note that figuring out that library X wasn't rebuilt correctly is only half the picture - we also need to know why library X should have been rebuilt, which means we need to know exactly what you did in your project). |
From @jdarwood007 on Tue, 31 Dec 2024 19:55:39 GMT
Description
Random app crashes on publish in AOT mode
I am randomly getting app crashes in my app, only in release mode and only after sending to the App store and running in TestFlight on a physical device. Making this very difficult to get debugging information.
The problem seems to go away randomly as well. I can sometimes get the error to go away after a few times of cleaning and building the solution. It is inconsistent in what I do to fix it. However I have determined that even with no code changes in my app, after a few times of rebuilding and cleaning that I can send the exact same code up and have it not crash.
I got a crash report and had all symbols stripped. So I've added this to my .csproj
This resulted in me being able to get this stack trace:
It seems the app is hitting
mono_exception_from_name_two_strings_checked
early on in the startup of my app, as indicated the code is in the main and xamarin triggered the faulty code.I hooked up the device to a Mac mini and was able to get the console to present the following error message
This seems to back the results of what I am experiencing in that the crash is occurring randomly and that cleaning fixes it, by possibly removing that out of date dependency.
To resolve the crashes, I have done the following, all sometimes work and at other times does not resolve the issue.
I don't have any project to provide, as it is random and by luck I feel, will just work for a bit. I've seen this on a few projects I work with and the resolution has always been the same, try to clean things and rebuild until it works.
I have noticed that more often than not, the problem seems to exist after I deployed a the app to the device via TestFlight , if I plug it into the mac and deploy the app in debug mode, unplug device, clean, rebuild and publish the app into TestFlight and install the TestFlight version, it will crash.
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
9.0.21 SR2.1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
Any
Did you find any workaround?
No response
Relevant log output
Copied from original issue dotnet/maui#26890
The text was updated successfully, but these errors were encountered: