-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Crash when app is deployed with dotnet publish #20981
Comments
Hi @jeremymarabel. 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. |
@rolfbjarne thoughts? |
Can you disable symbol stripping in the project file: <PropertyGroup>
<NoSymbolStrip>true</NoSymbolStrip>
</PropertyGroup> reproduce again, and then check if there are any crash reports (https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#crash-reports) and also check the device log (https://support.apple.com/en-in/guide/console/cnsl1012/mac) for any output there? |
@rolfbjarne Hi, I could not retrieve any recent logs via xcode, for whatever reason, all logs in my device are from last week... I added the NoSymbolStrip and could get this crash log via appcenter crash reporting tho, hope that helps.
|
So that's much more helpful:
This is probably an issue on our side, but the bad news is that we'll need a way to reproduce this ourselves in order to track it down. |
Hi @jeremymarabel. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. 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. |
Hi guys, hope you're all well with this journey. ;) I stumbled on this issue last week after multiple submissions to the MS Store where the application crashed on startup. Disable optimizationFirst step is to disable optimization on build. Add loggingThe second step is to add logging (AppCenter, Application Insights or Sentry) as early as possible to detect crashes and errors in the early stage of the application startup. The issues i encountered: ObservableCollection initialization with existing list should be avoided if this list could be null.Instead of using:
Try using the AddRange extension or similar to ensure this collection is not empty. I don't know why, but since .net 8 something has changed that causes this behavior.
This extension ensures that the collection is never null. If you can guarantee that list is not null, than you can keep using the initializer. foreach on a list while list is null causes crash.Instead of using:
Try use the EnsureNotNull extension or similar to ensure that the collection is null.
Check your order of styles in the resource dictionary.If you use DependentOn in your style, ensure that the depended style is on top of your style. As far as i know this was not an issue in the past, but it looks like the DependentOn searches the dictionary upwards causing the referenced style not to be found. Maybe this is done for performance reasons, but this could explain the multiple resource exceptions in 3th party libraries recently. Don't use async methods in the MauiProgramTry to avoid the use of async methods in the MauiProgram. Also don't use
I changed this file to an embedded resource and changed the code to:
Check that all your views, pages and windows use the correct base classThis is no brainer but, sometimes the view.xaml.cs file could use a different base class (ContentPage or interface). Just to be sure. All the views and windows should have x:DataType set to the ViewModelOn build you get a lot of errors/warnings that the page is missing the datatype for the compiled binding even you're using the regular
If you want to disable this behavior add the following attribute on top of the xaml.cs class:
Use the correct build statement to generate the msixThe right command is very important to generate a package that could be installed correctly. Sideload
Store upload
Remove the Maui CommunityToolkit (not verified!)I don't know if this also causes issues. Many people advice to remove it. Especially when you don't use it. After spending the whole night in this rabbit hole, i managed to get the sample app running in Release mode. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. |
Description
When building and deploying from the IDE all works well, but as soon as we try to build it via CI, using the same configuration it randomly crash after a few minutes/seconds
It seems to be related to a CollectionView issue, as when i remove this composant the crash does not occur. But i can't find any update done from a background thread from my code, and it does not crash when the debugger is attached.
Here is the relevant build config
I've tried with UseInterpreter and Optimize to true and false, without any change in behavior
I cant share the entire project for demonstration, but if needed i can try to create a new sample project that has the same behavior and share it.
Steps to Reproduce
Link to public reproduction project repository
No response
Version with bug
8.0.6 SR1
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
iOS 17
Did you find any workaround?
No response
Relevant log output
The text was updated successfully, but these errors were encountered: