dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

[Windows] Blazor Hybrid flickers on launch (white, then gray background) #19942

Open anth-git opened 10 months ago

anth-git commented 10 months ago

Description

When Blazor Hybrid app is launched on Windows, MAUI displays two additional screens before showing Blazor content:

  1. White blank screen
  2. Gray blank screen
  3. Only now Blazor content is displayed

All happens in a fraction of a second causing effect of flickering. Is there any way to eliminate this effect, or at least set some fixed background color to first two screens?

1 2 3 4

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.5

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows

Did you find any workaround?

No response

Relevant log output

No response

XamlTest commented 8 months ago

Verified this on 8.0.6. Repro on Windows 11 with .NET MAUI Blazor Hybird App template: MauiApp9.zip

dekipet commented 1 month ago

Hi, what I saw when starting MAUI Blazor Hybrid template app is that the first blank window is outside of the second one (which is app), it opens and closes quickly. I believe every BlazorWebView and/or WebView initialization causes that "effect", but I am not sure.

Startup sequence

First blank window:

MauiStartup1

Second window is actually app itself. Sometimes, shortly, both windows are on the screen together.

MauiStartup2
    <ItemGroup>
        <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.91" />
        <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.91" />
        <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.91" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
    </ItemGroup>

OS: Windows 10 & Windows 11

HNordhaus commented 1 month ago

This flashing window at startup seems new to me. I have observed this just for a couple of days, and I work with Blazor Hybrid everyday (it is my job). Is there any workaround?

HNordhaus commented 1 month ago

The problem has gone (for my .NET MAUI Blazor Hybrid App) after updating .NET 8.0.400 to the current version .NET 8.0.402