Skip to content
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

The app is crashing after sent to background IOS only #21533

Closed
alaa3latol opened this issue Mar 30, 2024 · 12 comments
Closed

The app is crashing after sent to background IOS only #21533

alaa3latol opened this issue Mar 30, 2024 · 12 comments
Labels
area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events platform/iOS 🍎 s/needs-attention Issue has more information and needs another look s/needs-repro Attach a solution or code which reproduces the issue s/no-recent-activity Issue has had no recent activity s/triaged Issue has been reviewed t/bug Something isn't working

Comments

@alaa3latol
Copy link

alaa3latol commented Mar 30, 2024

Description

I have a problem with IOS only when the app sent to background, it crashes and restarted.
I searched and tried to handle DidEnterBackground but nothing worked for me.

I have sent in the attachments AppDelegate file
AppDelegate.txt

Steps to Reproduce

I handled the DidEnterBackground function in AppDelegate but nothing worked

Link to public reproduction project repository

No response

Version with bug

8.0.3 GA

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

Relevant log output

No response

@alaa3latol alaa3latol added the t/bug Something isn't working label Mar 30, 2024
@jfversluis
Copy link
Member

Thanks for the report here. I'm very sorry but without any relevant code or logs or anything it will be impossible to determine if this is a potential bug in .NET MAUI or something in your codebase.

@jfversluis jfversluis added the s/needs-repro Attach a solution or code which reproduces the issue label Mar 30, 2024
@alaa3latol
Copy link
Author

I have updated the post and attached the appdelegate code file , I really don't know from where I begin.
AppDelegate.txt

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Mar 31, 2024
@alaa3latol
Copy link
Author

alaa3latol commented Apr 1, 2024 via email

@Yannikk1996
Copy link

Hi,
i have the same issue. My AppDelegate has no special code. I cannot get any logs. Debugger disconnects before anything can be traced. Any ideas how to trace this bug?

@neelpanchal52
Copy link

Hi,
I have the same issue. When the app is in the background it crashes and restarts and does not get any exceptions or logs.

@CoeqWEty
Copy link

CoeqWEty commented Apr 6, 2024

Hi we have the same issue. It constantly occurs. It seems relatively new. We've been trying to convert from xamarin 5 thru several net mauireleases.

This is likely a net Maui 8 issue.

This needs a an urgent high priority fix. Crashing in background makes it undeployable or and at minimum a very pooR Zux

@jfversluis

@Pastajello
Copy link

Pastajello commented Apr 9, 2024

I'd suggest removing api keys from the file at least. If needed consider sending the details to jsuarez/others privately. @alaa3latol

@Yannikk1996
Copy link

any news?

@jaosnz-rep jaosnz-rep added the s/triaged Issue has been reviewed label Apr 23, 2024
@umike72
Copy link

umike72 commented May 1, 2024

Seeing the same issue here. The problem started occurring once I've implemented the OnActivated method in AppDelegate. Even if there is no code in it, I get the exception "System.InvalidOperationException: 'Window was already deactivated' when sending the app to background by clicking on the iOS emulator home button.

I can reproduce it as follows (MAUI .net8, VS 17.9.6)

        [Foundation.Export("applicationDidBecomeActive:")]
        public override void OnActivated(UIKit.UIApplication application)
        {
            ;
        }

The stacktrace looks like this:

0xD in xxxxxx.Program.Main at D:\src\rlmc\xxxxx\Platforms\iOS\Program.cs:13,13
	at D:\src\rlmc\xxxxx\Platforms\iOS\Program.cs(13)

Program.cs wasn't modified from the auto-generated code. Commenting out the OnActivated() method makes the crash go away.

@umike72
Copy link

umike72 commented May 1, 2024

Update: Ignore my previous comment. If I add the line "base.OnActivated(application);" to the OnActivated() method shown above, the app won't crash when sending to background.

@PureWeen PureWeen added area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events s/needs-repro Attach a solution or code which reproduces the issue labels May 7, 2024
Copy link
Contributor

Hi @alaa3latol. 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.

@dotnet-policy-service dotnet-policy-service bot added the s/no-recent-activity Issue has had no recent activity label May 13, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events platform/iOS 🍎 s/needs-attention Issue has more information and needs another look s/needs-repro Attach a solution or code which reproduces the issue s/no-recent-activity Issue has had no recent activity s/triaged Issue has been reviewed t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants