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

Running app one day without touching it craching after move to other page #21576

Closed
danies8 opened this issue Apr 2, 2024 · 9 comments
Closed
Labels
platform/windows 🪟 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@danies8
Copy link

danies8 commented Apr 2, 2024

Description

Hi,
I have app that when i run it all day without touching it after login
and move to next page is carched.

Steps to Reproduce

1.Run the app.
2.Login
3Leavethe app running to one day and later move to another page.
4.App crached.
FlyoutExample (1).zip

Link to public reproduction project repository

...

Version with bug

8.0.3 GA

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

7.0.101

Affected platforms

Windows

Affected platform versions

....

Did you find any workaround?

No

Relevant log output

Faulting application name: XXXXXXX, version: 1.0.0.0, time stamp: 0x65680000
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1387, time stamp: 0x0b9a844a
Exception code: 0xc000027b
Fault offset: 0x000000000010b302
Faulting process id: 0x30c0
Faulting application start time: 0x01da802338803cbe
Faulting application path: XXXXXXXXXX
Faulting module path: C:\Windows\System32\KERNELBASE.dll
Report Id: 06ccce96-ab0d-447e-bace-eeb686ce73c8
Faulting package full name: 
Faulting package-relative application ID:
@danies8 danies8 added the t/bug Something isn't working label Apr 2, 2024
@danies8
Copy link
Author

danies8 commented Apr 2, 2024

There is a timer running in main page , please look on OnAppearing+ OnDisappearing event.

@danies8
Copy link
Author

danies8 commented Apr 3, 2024

Before you run the app published as exe
set maui as start project
right click on project name and open in terminal.
dotnet publish -f net8.0-windows10.0.19041.0 -c Release -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true -p:RuntimeIdentifierOverride=win10-x64

@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 3, 2024
@Zhanglirong-Winnie
Copy link
Collaborator

Verified this issue with Visual Studio 17.10.0 Preview 2(8.0.14). Can repro on windows platform with sample project.

@danies8
Copy link
Author

danies8 commented Apr 3, 2024

Did you reproduced on windows platform.
What I need to do to fix it

@drasticactions
Copy link
Contributor

protected override void OnAppearing()
    {
        base.OnAppearing();
   
        MainThread.BeginInvokeOnMainThread(() =>
        {
            serviceButton.TextColor = Color.FromRgb(0, 128, 0);
        });

        if (_timer == null)
        {
            var dispatcher = this.Dispatcher;

            _timer = dispatcher.CreateTimer();
            _timer.Interval = TimeSpan.FromSeconds(30);
            _timer.Tick += (s, e) =>
            {
                MainThread.BeginInvokeOnMainThread(() =>
                {
                    serviceButton.TextColor = Color.FromRgb(128, 0, 0);
                });

            };
            _timer.IsRepeating = true;

            _timer.Start();
        }


    }

    protected override void OnDisappearing()
    {
        base.OnDisappearing();
        if (_timer != null)
        {
            _timer.Stop();
        }
    }

If you remove this DispatchTimer, does it stop crashing?

@drasticactions drasticactions added the s/needs-info Issue needs more info from the author label Apr 4, 2024
@danies8
Copy link
Author

danies8 commented Apr 4, 2024

@drasticactions
I will check.
I need timer , i did'nt created it well ? no possible to create timer with MAUI ?

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Apr 4, 2024
@drasticactions
Copy link
Contributor

It's trying to isolate if the issue is MAUI specific, or if having an ever-increasing DispatcherTimer is causing issues in Windows in general.

The code you're calling is from MAUI essentials, which implements Windows functions. If you ran the underlying code creating the Dispatcher Timer in a WinUI app and had the same crash after leaving it on, it would most likely be a WinUI/Windows issue.

If you remove the timer and it still crashes, then there testing would be more needed to isolate why it crashes for you.

@danies8
Copy link
Author

danies8 commented Apr 4, 2024

Evrerything is OK.
You can close the ticket.
Thank you.

@danies8 danies8 closed this as completed Apr 17, 2024
@danies8
Copy link
Author

danies8 commented Apr 17, 2024

Thank you

@github-actions github-actions bot locked and limited conversation to collaborators May 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/windows 🪟 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants