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

Blazor Hybrid Windows: Window was already activated when minimize and restore from taskbar #14142

Closed
samhouts opened this issue Mar 22, 2023 · 8 comments · Fixed by #14152
Closed
Assignees
Labels
area-controls-window Window area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! high It doesn't work at all, crashes or has a big impact. i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 t/bug Something isn't working

Comments

@samhouts
Copy link
Member

Description

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

  1. File > New MAUI Blazor
  2. Run in Windows
  3. Minimize
  4. Restore
  5. 💥

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

@samhouts samhouts added t/bug Something isn't working platform/windows 🪟 high It doesn't work at all, crashes or has a big impact. i/regression This issue described a confirmed regression on a currently supported version labels Mar 22, 2023
@samhouts
Copy link
Member Author

Related? #14138

@rachelkang rachelkang added this to the Backlog milestone Mar 22, 2023
@ghost
Copy link

ghost commented Mar 22, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@rachelkang
Copy link
Member

@samhouts is this only happening with the Blazor hybrid template? Or are you running into this issue with any of the other templates?

@rachelkang rachelkang added the s/needs-info Issue needs more info from the author label Mar 22, 2023
@ghost
Copy link

ghost commented Mar 22, 2023

Hi @samhouts. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@rachelkang rachelkang added area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events area-controls-window Window labels Mar 22, 2023
@samhouts
Copy link
Member Author

weeeelllll my other templates disappeared, so I haven't checked yet. the joys of targeting main.... 😅

@ghost ghost 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 Mar 22, 2023
@PureWeen
Copy link
Member

PureWeen commented Mar 22, 2023

@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 :-)

@PureWeen
Copy link
Member

@samhouts here it is
microsoft/microsoft-ui-xaml#7343

@samhouts
Copy link
Member Author

Aha! So we need to touch up #13025. Thanks!!

I found a bug I found a bug 💃💃

@samhouts samhouts removed the s/needs-attention Issue has more information and needs another look label Mar 22, 2023
@PureWeen PureWeen self-assigned this Mar 22, 2023
@samhouts samhouts modified the milestones: Backlog, .NET 8, .NET 8 Planning Mar 22, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! label Apr 12, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-window Window area-core-lifecycle XPlat and Native UIApplicationDelegate/Activity/Window lifecycle events fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! high It doesn't work at all, crashes or has a big impact. i/regression This issue described a confirmed regression on a currently supported version platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants