Blazor Hybrid Windows: Window was already activated when minimize and restore from taskbar
See original GitHub issueDescription
I have a Blazor Hybrid app, debugging in Windows. I’m running against maui main.
If I minimize the app and then try to restore it again by clicking on the icon in the taskbar, I get an instacrash:
System.InvalidOperationException
HResult=0x80131509
Message=Window was already activated
Source=Microsoft.Maui.Controls
StackTrace:
at Microsoft.Maui.Controls.Window.Microsoft.Maui.IWindow.Activated() in C:\src\github\maui\src\Controls\src\Core\HandlerImpl\Window\Window.Impl.cs:line 491
at Microsoft.Maui.LifecycleEvents.AppHostBuilderExtensions.<>c.<OnConfigureLifeCycle>b__2_2(Window window, WindowActivatedEventArgs args) in C:\src\github\maui\src\Core\src\Hosting\LifecycleEvents\AppHostBuilderExtensions.Windows.cs:line 32
at Microsoft.Maui.MauiWinUIWindow.<>c__DisplayClass7_0.<OnActivated>b__1(OnActivated del) in C:\src\github\maui\src\Core\src\Platform\Windows\MauiWinUIWindow.cs:line 51
at Microsoft.Maui.LifecycleEvents.LifecycleEventServiceExtensions.InvokeLifecycleEvents[TDelegate](IServiceProvider services, Action`1 action) in C:\src\github\maui\src\Core\src\LifecycleEvents\LifecycleEventServiceExtensions.cs:line 31
at Microsoft.Maui.MauiWinUIWindow.OnActivated(Object sender, WindowActivatedEventArgs args) in C:\src\github\maui\src\Core\src\Platform\Windows\MauiWinUIWindow.cs:line 51
at ABI.Windows.Foundation.TypedEventHandler`2.Do_Abi_Invoke[TSenderAbi,TResultAbi](Void* thisPtr, TSenderAbi sender, TResultAbi args)
Steps to Reproduce
- File > New MAUI Blazor
- Run in Windows
- Minimize
- Restore
- 💥
Link to public reproduction project repository
try vigilant guide
Version with bug
Unknown/Other (please specify)
Last version that worked well
7.0 (current)
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
windows10.0.19041.0
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created 6 months ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
The Window.Activated event fires twice after maximizing a ...
Describe the bug If you minimize a window and then maximize it you will get two symmetrical Activated events // Minimize window OnActivated....
Read more >How To Disable "Restore Down" In .NET MAUI Blazor ...
I have created one .NET MAUI Blazor Component App. I want to restrict users to not restoring down the window. Simply, I want...
Read more >How to restore a minimized window using AppActivate ...
The trick to making this work all the time is to minimize and then restore. This way, the app flickers, but always restores...
Read more >Blazor Hybrid (MAUI) - Customize TitleBar
This is a follow-up to a previous question. I now see that the Title Bar customization API only works for Windows 11 (AppWindow....
Read more >Blazor Hybrid Web Apps with .NET MAUI
With Blazor Hybrid, native desktop on Android, iOS, macOS, and Windows are now ... screen recording, system-tray support for minimized apps, and more....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@samhouts here it is https://github.com/microsoft/microsoft-ui-xaml/issues/7343
@samhouts this is an issue with WinAppSDK (can’t find the original issue)
WinUI calls Activated twice when you maximize, and we aren’t debouncing that second call.
I forgot about this when I added this exception 😃