-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 Maui release build crashes but debug build is fine #18870
Comments
Hi @sachinkanadia. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Without a repro project or a stack trace, this will most likely be impossible to debug. Would it be possible to create a project showing your issue, or a stack trace from the release build? @rolfbjarne Are there other things they could provide to help diagnose this? |
All the stack trace says is that there was an unhandled exception, but nothing about the exception itself. As a wild guess, try enabling the interpreter to see if that makes a difference (it's enabled by default for Debug builds already; this would enable it for all builds): <PropertyGroup>
<UseInterpreter>true</UseInterpreter>
</PropertyGroup> |
I'm having the same issue with both local and Azure pipeline builds. Debug works fine but release crashes immediately on startup. Things I've tried:
|
Can you attach your csproj? |
Unfortunately, I cannot. However, since it's working in Debug but not Release, I changed my Debug build to Link SdkOnly, and now I can see this error immediately upon startup:
|
So my issue ended up being with a library that I had recently brought in, TinyMapper. While I could have probably taken the time to figure out what was being linked out, I just removed the library and refactored my code, and now release builds are running correctly in Azure. |
Not the same here. @rolfbjarne I tried enabling the interpreter but I got the same crash with the same stack trace. |
Does disabling the linker help? <PropertyGroup>
<MtouchLink>None</MtouchLink>
<UseInterpreter>true</UseInterpreter>
</PropertyGroup> |
@rolfbjarne it still fails but I think it produces a different log which I've attached. The IPS file is not symbolicated as I can't seem to find it in the organizer in XCode. |
Can you try disabling symbol stripping to see if that makes the crash report more useful? <PropertyGroup>
<MtouchLink>None</MtouchLink>
<UseInterpreter>true</UseInterpreter>
<NoSymbolStrip>true</NoSymbolStrip>
</PropertyGroup> |
LightWork-2023-11-28-162617.txt |
That didn't clarify much :/ Are you able to reproduce locally by building the Release configuration (as opposed to having to publish the app first)? |
I am currently building and deploying locally to my physical iOS device. I am setting the release profile and certificate to development. As its release build it doesn't debug, but it does deploy. When I run the deployed app it just crashes immediately and this is without any debugger attached so I can't see any exception raised in VS. |
Can you get a binlog for a working Debug build and a failing Release build and attach them here? That should make it possible to see the differences in the build configuration that causes this. |
@sachinkanadia can you disable stripping of native symbols, try again, and see if the resulting stack trace is more descriptive? Just add this to the project file: <PropertyGroup>
<NoSymbolStrip>true</NoSymbolStrip>
</PropertyGroup> |
It looks like the symbols were still stripped. Did you clean your project after changing the project file? If cleaning doesn't change anything, please get a binary build log (https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#binary-build-logs) and attach it here, which should explain why the symbols are still stripped.
Because iOS doesn't let us add anything to the crash report. Third-party crash reporters typically collect more information about fatal exceptions. Additionally, more information will be printed to the device log (https://support.apple.com/en-in/guide/console/cnsl1012/mac). |
I cleaned the project and rebuilt the project. Still, the same stack trace persists. |
|
@rolfbjarne My extensions manager is not showing any extensions. I am running VS Mac 17.6.10 (build 428). Is there a source that I need to add? Or do you have a link to Project System Tools for Mac that I can download? |
@sachinkanadia no idea, I've never seen that before. And since VSMac is going out of support in a few months, I don't think any issues will be fixed. My recommendation would be to either try building from the command line and getting a binlog that way (which is much easier), or use VSCode. |
@rolfbjarne Wouldn't I still need to download the Project System Tools for Mac to build from the command line in order to obtain the binlog? Also would you be able to point me to the instructions for building from the command line, please? Thanks |
@rolfbjarne The above build configuration has produced the following build log output when executing:
Please let me know what you find, (Why it is stripping debug symbols which hides the runtime exception) many thanks. |
Hey @rolfbjarne have you had a chance to look at this? Thanks |
Sorry for the late reply, I've been away.
Unfortunately that revealed that the symbols are not stripped away, so I have no idea why the crash report is so useless. However, can you try getting the device log (https://support.apple.com/en-in/guide/console/cnsl1012/mac) and see if it says something useful? |
I see this error in the device log against my App: Unhandled managed exception: Attempting to JIT compile method '(wrapper dynamic-method) LightWork.Entities.Exercise object:Thunk1ret_Exercise_QueryContext_DbDataReader_ResultContext_SingleQueryResultCoordinator (System.Func The question is do you think this is causing the App to crash? Using Delegates to call Native Functions [UnmanagedFunctionPointerAttribute](preferred, since it is cross-platform and compatible with .NET Standard 1.1+) Source: https://learn.microsoft.com/en-gb/xamarin/ios/internals/limitations |
Aha! It's solved! I stumbled upon this article: #9176 Which helped me get to the solution. I had to enable the interpreter and delete the obj and bin folders before building in Release mode. Thanks @rolfbjarne your help has been imperative! |
Description
Hello,
I have an app (LightWork) that I want to publish on the Apple App Store. The debug build runs and works fine, however, on submission the release build crashes on start up. The symbolicated crash report can be found here:
https://stackoverflow.com/questions/77495334/net-maui-release-build-crashes-but-debug-build-is-fine
I tried disabling XAML compilation & setting the same build configuration against the debug. So I can confirm I don't think it has anything to do with XAML or the build configuration.
I have no idea why its failing and its preventing release. If anyone can help that would be much appreciated.
Many Thanks!
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
7.0.100
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
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: