-
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
Crashing on iPad when backgrounded #25723
Comments
Also, this crash does not get reported by Sentry.io like other uncaught exceptions. |
Does this replicate with something that isn't your application (Ex. a new Template app?) or does it only happen when run in your app? |
I have not been able to create a simple app to reproduce the crash. But it happens 100% of the time on iPad. I did add a catch in Program.cs
Here is the logged exception:
I cannot figure out what about going into the background would produce this crash. Also, why does AppleCryptoNative_X509ImportCertificate appears so many times? And why would crypto be interspersed with UIKit calls? Is this happening due to snapshotting by iOS when the app goes to background? |
Are you using background services? Like fetch or processing? From the stack trace it's clear that iOS kills your app because it ran in the background for more than 10 seconds, which is not allowed. |
@albyrock87 No, no background services.
|
@ksoftllc well, that Are you invoking the |
I simplified the AppDelegate to just this, but it still crashes.
The stack trace shows AppleCryptoNative_X509ImportCertificate activity, which I really don't understand why. When the app is backgrounded or even foregrounded, there is nothing in the code that would explicitly invoke crypto. |
Thanks for confirming. |
More info from additional logging. Here is a stack trace of the crash:
The only line of our source in this trace is Program.cs line 16:
So whatever is happening upon being backgrounded, is happening deep in Maui/Xamarin/Dotnet code. Somehow, UI Code is being triggered. The presence of AppleCrypto in the stack is also interesting. I wonder if that has to do with prefences, which I believe use encryption. |
It may be this line:
However, the stack seems to indicate that this all starts with
It looks like the theme is changing in the background for some reason... I wonder if you were to implement class App : Application, IApplication
{
...
void IApplication.ThemeChanged(...)
{
// do nothing
}
} |
@mattleibow That was it! I implemented
Output:
So how can I block these only while in background? Or is there something in my code causing all these events to fire? |
@mattleibow If I implement
|
This repo has a simple project to reproduce the crash on backgrounding: https://github.com/ksoftllc/CrashOnBackgroundIos |
Description
When our MAUI app for iOS is run on iPad, it crashes a few seconds after being backgrounded by pressing home button. Interestingly, this doesn't happen on iPhone and doesn't happen on simulator.
Steps to Reproduce
Launch app on iPad.
Press home button.
Wait about 2 or 3 seconds.
Crash.
Link to public reproduction project repository
No response
Version with bug
8.0.91 SR9.1
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
No response
Affected platforms
iOS
Affected platform versions
17.x and 18.1
Did you find any workaround?
No workaround
Relevant log output
Here is the symbolicated crash log:
I don't see anything here from our source code, but would love some help interpreting this.
The text was updated successfully, but these errors were encountered: