-
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
App Lifecycle event OnResume called more than once. #7894
Comments
Just checked for Android API 31 (Pixel 5), by changing the target for debug, and it doesn't appear to occur. To confirm I also debugged on the OOTB 'VisualStudio_android-25_x86_phone (Android 7.1 - API 25)" emulator, and it does not occur on this either. |
I have checked the Platforms, specifically for the Windows platform, and any additional builder wire-ups, and there is nothing that I can find that the default template provides that could account for multiple invokes. |
I have additionally added OnSleep and OnStart, to determine if these are invoked more than once also. I can confirm that on both "Windows Machine" and "Android Emulator" that OnSleep and OnStart are correctly invoked 1 time. Code used: public partial class App : Application
{
private int ResumeCount, SleepCount, StartCount = 0;
public App()
{
InitializeComponent();
MainPage = new AppShell();
}
/// <summary>Perform actions when the application resumes from a sleeping state.</summary>
protected override void OnResume()
{
base.OnResume();
ResumeCount++;
System.Diagnostics.Debug.WriteLine("{0}: Restarted {1}", DateTimeOffset.UtcNow, ResumeCount);
}
protected override void OnSleep()
{
base.OnSleep();
SleepCount++;
System.Diagnostics.Debug.WriteLine("{0}: Gone to sleep {1}", DateTimeOffset.UtcNow, SleepCount);
}
protected override void OnStart()
{
base.OnStart();
StartCount++;
System.Diagnostics.Debug.WriteLine("{0}: Started {1}", DateTimeOffset.UtcNow, StartCount);
}
} |
I have created a repository and added in platform life-cycle event logging in addition to the cross-platform lift-cycle logging. You can find it here: PlatformLifeCycleDemo on GitHub The big takeaway for logging is below and on the repository:
Then the Android Emulator is used in debug, the following events occur:
|
Not to say for sure, but I think it's the OnVisibilityChanged platform event being called after the OnResumed and onActivated events, which is invoking the cross-platform OnResume event the second time. |
AFAICT this is a bug with the WinAppSdk firing the |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Description
The application lifecycle event OnResume is called more than once when an application is minimised/stopped and then resumed.
Steps to Reproduce
Restarted 1
Restarted 2
Version with bug
6.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Android 21.0, Windows 10.0.17763.0
Did you find any workaround?
No response
Relevant log output
Depends on
The text was updated successfully, but these errors were encountered: