maui icon indicating copy to clipboard operation
maui copied to clipboard

The app is crashing after sent to background IOS only

Open alaa3latol opened this issue 1 year ago • 12 comments

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 avatar Mar 30 '24 03:03 alaa3latol

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 avatar Mar 30 '24 09:03 jfversluis

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

alaa3latol avatar Mar 31 '24 11:03 alaa3latol

Dear Gerald, I really don't know which code should I share! , I attached the AppDelegate file. if there any code files you want me to share please let me know.

best regards Alaa Atef

On Sat, Mar 30, 2024 at 11:50 AM Gerald Versluis @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/dotnet/maui/issues/21533#issuecomment-2027995278, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHOI2KSZ5HWWYX2XVJZ3P5DY2Z4DPAVCNFSM6AAAAABFPG76D2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXHE4TKMRXHA . You are receiving this because you were mentioned.Message ID: @.***>

alaa3latol avatar Apr 01 '24 11:04 alaa3latol

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?

Yannikk1996 avatar Apr 02 '24 10:04 Yannikk1996

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.

neelpanchal52 avatar Apr 05 '24 10:04 neelpanchal52

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

CoeqWEty avatar Apr 06 '24 01:04 CoeqWEty

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

Pastajello avatar Apr 09 '24 07:04 Pastajello

any news?

Yannikk1996 avatar Apr 21 '24 09:04 Yannikk1996

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 avatar May 01 '24 00:05 umike72

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.

umike72 avatar May 01 '24 04:05 umike72

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.

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.

@umike72 Hi- Did you do something to an app that goes to background to not restart. Can you send code inline. We still experience the issue and tried multiple things. We get a crash reported by testflight but its just app restarts instead of staying open.

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.

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.

CoeqWEty avatar May 30 '24 13:05 CoeqWEty