-
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
[Android] App crashes when start from background #4169
Comments
not repro on the latest build, please try on the latest build and tell us if any problems. |
@zhouwangyang what exactly build version? |
@brzezinol I reproduced on vs latest build 17.2.0 Preview 2.0. |
FWIW... // App.xaml.cs
protected override Window CreateWindow(IActivationState activationState)
{
// Workaround for: 'Either set MainPage or override CreateWindow.'??
if (this.MainPage == null)
{
this.MainPage = new MainPage();
}
return base.CreateWindow(activationState);
} |
Not reproducible with android 11. app can be start. |
@shimingsg can you explain why you consider this issue closed ? for me there is still a problem (im on android 11, maui-check say everything is up to date). The workaround of @vamsitp in not enough because we have to recreate all the MainPage so we lost the state the app when she was putted in background. thanks ! |
@julienGrd I repro this by the repro steps on Android 11 with vs 32214.398.main, app can be start, not crashes, so I close it, if you can repro this issue, can you upload your repro project, or provide some repro video? it is helpful, thanks. |
@shimingsg is it the same behavior than us ?
I reproduce this with the starter project on my side so no need to upload one specific |
actually i just made update to visual studio 17.2.0 preview 1.0, with fresh install of .net maui workload preview 13, and i still encounter the problem on a fresh startup project. |
I can confirm this is still an issue, and am working on it! Thanks for the patience everyone. In the meantime, I can also confirm that @vamsitp's workaround is valid |
zhouwangyang same here. Is there a temporary workaround? I mean the main page is already set to AppShell.xaml.cs. And wth happens when you override the launch? I'm guessing nothing good. |
I haven't updated to the RC Maui version yet (still on Version 17.2.0 Preview 2.1) but the error did still persist on that version |
I was able to verify I no longer have this issue (with the workaround removed) using RC1. I used the steps in OP to verify. |
Description
I have created new app after update to VS 2022 17.1.0 Preview 2.0.
Clean app crashes when is started from background with error:
System.NotImplementedException: 'Either set MainPage or override CreateWindow.'
Steps to Reproduce
Version with bug
Preview 11
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11
Did you find any workaround?
No response
Relevant log output
The text was updated successfully, but these errors were encountered: