Weird bug with UWP apps

Евгений Алексеев 81 Reputation points
2022-01-30T10:11:11.713+00:00

In my app, in the menu I have the Exit button (MenyFlyoutItem). I use this code for this button to work: CoreApplication.Exit();
It works just great, but I've noticed that right before my app closes it kind of flashes for a second and the app is colored with the accent color of my system. It happens really fast, but it is noticeable. It also sometimes happens when I expand my app. I've noticed the same thing with many UWP apps, including the apps from Microsoft. Is this a bug or something? Here's what it looks like in my app:166324-untitled.png

EDIT:

So, I just tried to create an UWP app with C++ and I added the regular Exit button on the MainPage and used this code for this button: Application::Current->Exit(); and I get the same bug when I click the button. I assume, the bug is not relevant to any code or language specifically, but relevant to UWP apps. Also, I should probably mention that I experience it on Windows 11. I don't remember whether or not it was a thing on Windows 10. I would love to know whether or not this kind of behavior is normal for UWP apps, or it's something to do with my system specifically? Maybe there's a way to fix this?

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,278 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ken Tucker 5,846 Reputation points
    2022-01-30T14:17:05.877+00:00

    Try this instead it

             await ApplicationView.GetForCurrentView().TryConsolidateAsync();  
    

    https://learn.microsoft.com/en-us/uwp/api/windows.ui.viewmanagement.applicationview.tryconsolidateasync?view=winrt-22000


0 additional answers

Sort by: Most helpful