Electron.NET icon indicating copy to clipboard operation
Electron.NET copied to clipboard

Content After Splash Screen Is Blank Until Click

Open sthomas-fcbh opened this issue 2 years ago • 8 comments

ElectronNET.CLI 13.5.1 ElectronNET.API 13.5.1

NodeJs version 6.14.12 (not sure if used)

Blazor Application Using net5.0 Target Framework

When I run my Blazor app as a windows desktop application using Electron, the splash screen shows, and then a blank screen shows. If I do not interact with the screen from that point, the blank screen persists and the app hangs on the blank screen.

Clicking the screen or hovering the mouse over Electron window seems to trigger the content of the page loading. After clicking I can resume use of the app as normal.

Steps to Reproduce:

  1. Create Blazor (may not have to be Blazor) application with electron.
  2. Add splash screen to electron.manifest.json
  3. Run the electron app. Do not interact with the computer (i.e. mouse, keyboard) while the app is starting.
  4. Verify the splash screen shows.
  5. Verify a blank screen shows after the splash screen is hidden.
  6. Click around inside and outside of the electron window. Verify the blank screen goes away.

Note: this issue occurs sporadically, so it may take a few tries to reproduce.

After splash screen, before click: image

After splash screen, after click:

image

sthomas-fcbh avatar Oct 13 '21 19:10 sthomas-fcbh

Same problem here.

net5 and ReactJs

I tried some things like setting focus programmatically after the window opens, but with no success.

TiagoBrazSantos avatar Oct 15 '21 13:10 TiagoBrazSantos

We are also seeing this problem sporadically. I've tried with a frameless window and a TitleBarStyle.hidden and the problem exists in both cases.

Question to @TiagoBrazSantos and @sthomas-fcbh - are y'all using a frameless window or does the problem occur even in a regular window?

pvenky avatar Nov 13 '21 16:11 pvenky

I'm seeing the same issue. My splash screen displays properly, followed by my app. But...my app page is blank, until I grab the app window with the mouse and move it. Then it refreshes, and all is well.

Interestingly, the bug does not happen when I run in debug mode in Visual Studio 2022 (or VS2019). It's only with a Release build/install that this occurs.

        public async void Electronize()
        {
            var electronOptions = new BrowserWindowOptions { AutoHideMenuBar = true, Width = 1024, Height = 1024, MinWidth = 1024, MinHeight = 1024, Icon = "GreekVocabBuilder.ico" };
            var mainWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { AutoHideMenuBar = true, EnableLargerThanScreen = true, Width = 1024, Height = 1024, MinWidth = 1024, MinHeight = 1024 });
            mainWindow.OnReadyToShow += () => mainWindow.Show();
        }


These are the startup options I have in my Startup.cs file Configure method.

UPDATE: In fact, if you wait 10 seconds or so, the page will eventually show (at times), even without moving the main window. However, as mentioned above, if you do move the main window, the page immediately refreshes, and you can see the page context as expected.

jeffdod avatar Nov 25 '21 22:11 jeffdod

Hello,

Yes, I'm using a custom icon.

In the electron.manifest.json file, I'm using this to configure the custom icon:

"win": { "icon": "../../../GreekVocabBuilder.ico" }

Similarly, for the splash screen, I'm using a custom image, and specifying it in electron.manifest.json like so:

"splashscreen": { "imageFile": "/wwwroot/assets/img/GreekVocabBuilder.png" }

Sincerely, Jeff Dodson

On Sat, Nov 27, 2021 at 9:43 AM Guillermo Orue Marighetti < @.***> wrote:

I'm seeing the same issue. My splash screen displays properly, followed by my app. But...my app page is blank, until I grab the app window with the mouse and move it. Then it refreshes, and all is well.

Interestingly, the bug does not happen when I run in debug mode in Visual Studio 2022 (or VS2019). It's only with a Release build/install that this occurs.

    public async void Electronize()
    {
        var electronOptions = new BrowserWindowOptions { AutoHideMenuBar = true, Width = 1024, Height = 1024, MinWidth = 1024, MinHeight = 1024, Icon = "GreekVocabBuilder.ico" };
        var mainWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { AutoHideMenuBar = true, EnableLargerThanScreen = true, Width = 1024, Height = 1024, MinWidth = 1024, MinHeight = 1024 });
        mainWindow.OnReadyToShow += () => mainWindow.Show();
    }

These are the startup options I have in my Startup.cs file Configure method.

UPDATE: In fact, if you wait 10 seconds or so, the page will eventually show (at times), even without moving the main window. However, as mentioned above, if you do move the main window, the page immediately refreshes, and you can see the page context as expected.

How have you configured to place a custom .ico? What path does this icon configuration point to?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ElectronNET/Electron.NET/issues/615#issuecomment-980645442, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6APALVEOCR7QI3B5LKONDUOD4C5ANCNFSM5F55O5YA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jeffdod avatar Nov 27 '21 21:11 jeffdod

Hello, Yes, I'm using a custom icon. In the electron.manifest.json file, I'm using this to configure the custom icon: "win": { "icon": "../../../GreekVocabBuilder.ico" } Similarly, for the splash screen, I'm using a custom image, and specifying it in electron.manifest.json like so: "splashscreen": { "imageFile": "/wwwroot/assets/img/GreekVocabBuilder.png" } Sincerely, Jeff Dodson On Sat, Nov 27, 2021 at 9:43 AM Guillermo Orue Marighetti < @.***> wrote: I'm seeing the same issue. My splash screen displays properly, followed by my app. But...my app page is blank, until I grab the app window with the mouse and move it. Then it refreshes, and all is well. Interestingly, the bug does not happen when I run in debug mode in Visual Studio 2022 (or VS2019). It's only with a Release build/install that this occurs. public async void Electronize() { var electronOptions = new BrowserWindowOptions { AutoHideMenuBar = true, Width = 1024, Height = 1024, MinWidth = 1024, MinHeight = 1024, Icon = "GreekVocabBuilder.ico" }; var mainWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions { AutoHideMenuBar = true, EnableLargerThanScreen = true, Width = 1024, Height = 1024, MinWidth = 1024, MinHeight = 1024 }); mainWindow.OnReadyToShow += () => mainWindow.Show(); } These are the startup options I have in my Startup.cs file Configure method. UPDATE: In fact, if you wait 10 seconds or so, the page will eventually show (at times), even without moving the main window. However, as mentioned above, if you do move the main window, the page immediately refreshes, and you can see the page context as expected. How have you configured to place a custom .ico? What path does this icon configuration point to? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#615 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6APALVEOCR7QI3B5LKONDUOD4C5ANCNFSM5F55O5YA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Thank you Jeff, sorry for delete the previous issue.

ggomarighetti avatar Nov 27 '21 23:11 ggomarighetti

One other thing I should probably mention: This "bug" only occurs with a Windows build. If I build and run on a Linux (i.e., Ubuntu) system, everything works...the splash screen splashes, then the app window shows up, and everything instantly displays as it should. So at least for me, this seems to be a Windows-only problem.

jeffdod avatar Nov 28 '21 01:11 jeffdod

Hi, I have the same issue (win 10), is there any workaround?

f4n0 avatar Jun 09 '22 07:06 f4n0

It has something to do with the Chromium rendering engine. If I put a window over my blank screen it will also redraw and show content. The blank screen occurs in 50% of the cases on my computer. But...

There is a workaround!

What I do is a browserWindow.Reload() as last step within the Configure() method. My Configure method looks like this:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 
{
    ...
  Task.Run(async () =>
  {
      Electron.Menu.SetApplicationMenu(GetElectronNetMenu());
      var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions() { Show = false });
      browserWindow.Show();
      browserWindow.Maximize();
      browserWindow.Reload(); // Prevents showing a white screen (sometimes)
  });

tonsnoei avatar Aug 23 '22 17:08 tonsnoei

Thank you for the workaround!

jeffdod avatar Jan 07 '23 17:01 jeffdod

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

GregorBiswanger avatar Mar 28 '23 15:03 GregorBiswanger