Electron.net: Blank Page with Blazor (ASP.NET Core hosted) Preview 6

Created on 16 Jun 2019  路  10Comments  路  Source: ElectronNET/Electron.NET


  • Version: 5.22.12

dotnet --version
3.0.100-preview6-012264

  • Target: win-x64


Steps to Reproduce:

  1. Created a vanilla Blazor (ASP.NET Core hosted)
  2. Added ElectronNET.API to the Server project
  3. Setup Electron.NET stuff as described here https://maherjendoubi.io/blazor-electron/
  4. electonize init
  5. electronize start

The result is the following:

image

bug

Most helpful comment

I spent a few hours yesterday digging into this issue, and I figured it out. It really has nothing to do with Electron.NET, and everything to do with the changes they made to the Endpoint Routing. With the Preview 6 changes, not all of the files were exposed to the Host, and the ones that were weren't in the right spot.

After a few hours of testing, I was able to get everything working and into a NuGet package that could handle the changes. I didn't make a PR here yet because it requires VS2019, and I didn't want to force that upgrade on the project without asking. So for now, it's in my own repo.

If you get a chance, please test it out (instructions are on the repo home page) and let me know if it works for you. Then we can discuss if it needs to move.

Thanks!

All 10 comments

electronize start
Start Electron Desktop Application...
Microsoft Windows [version 10.0.18362.175]
(c) 2019 Microsoft Corporation. Tous droits r茅serv茅s.
C:UsersMahersourcereposWebApplication20WebApplication20.Server>dotnet publish -r win-x64 --output "C:UsersMahersourcereposWebApplication20WebApplication20.ServerobjHostbin"
Microsoft (R) Build Engine version 16.2.0-preview-19278-01+d635043bd pour .NET Core
Copyright (C) Microsoft Corporation. Tous droits r茅serv茅s.
Restauration effectu茅e dans 19,34 ms pour C:UsersMahersourcereposWebApplication20WebApplication20.ClientWebApplication20.Client.csproj.
Restauration effectu茅e dans 19,21 ms pour C:UsersMahersourcereposWebApplication20WebApplication20.SharedWebApplication20.Shared.csproj.
Restauration effectu茅e dans 23,89 ms pour C:UsersMahersourcereposWebApplication20WebApplication20.ServerWebApplication20.Server.csproj.
C:Program Filesdotnetsdk3.0.100-preview6-012264SdksMicrosoft.NET.SdktargetsMicrosoft.NET.RuntimeIdentifierInference.targets(158,5): message : NETSDK1057聽: Vous utilisez une pr茅version de .NET Core. Voir聽: https://aka.ms/dotnet-core-preview [C:UsersMahersourcereposWebApplication20WebApplication20.ServerWebApplication20.Server.csproj]
C:Program Filesdotnetsdk3.0.100-preview6-012264SdksMicrosoft.NET.SdktargetsMicrosoft.NET.RuntimeIdentifierInference.targets(158,5): message : NETSDK1057聽: Vous utilisez une pr茅version de .NET Core. Voir聽: https://aka.ms/dotnet-core-preview [C:UsersMahersourcereposWebApplication20WebApplication20.SharedWebApplication20.Shared.csproj]
WebApplication20.Shared -> C:UsersMahersourcereposWebApplication20WebApplication20.SharedbinDebugnetstandard2.0WebApplication20.Shared.dll
WebApplication20.Client -> C:UsersMahersourcereposWebApplication20WebApplication20.ClientbinDebugnetstandard2.0WebApplication20.Client.dll
Blazor Build result -> 33 files in C:UsersMahersourcereposWebApplication20WebApplication20.ClientbinDebugnetstandard2.0dist
WebApplication20.Server -> C:UsersMahersourcereposWebApplication20WebApplication20.ServerbinDebugnetcoreapp3.0win-x64WebApplication20.Server.dll
WebApplication20.Server -> C:UsersMahersourcereposWebApplication20WebApplication20.ServerobjHostbin
C:UsersMahersourcereposWebApplication20WebApplication20.Server>
Skip npm install, because node_modules directory exists in: C:UsersMahersourcereposWebApplication20WebApplication20.ServerobjHostnode_modules
Invoke electron.cmd - in dir: C:UsersMahersourcereposWebApplication20WebApplication20.ServerobjHostnode_modules.bin
Microsoft Windows [version 10.0.18362.175]
(c) 2019 Microsoft Corporation. Tous droits r茅serv茅s.
C:UsersMahersourcereposWebApplication20WebApplication20.ServerobjHostnode_modules.bin>electron.cmd "....main.js"
stdout: Use Electron Port: 8000
stdout: info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:UsersMaherAppDataLocalASP.NETDataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
ASP.NET Core Application connected... global.electronsocket GLstc8UetcSP0PiFAAAA 2019-06-17T22:08:12.520Z
stdout: Hosting environment: Production
Content root path: C:UsersMahersourcereposWebApplication20WebApplication20.ServerobjHostbin
Now listening on: http://localhost:8001
Application started. Press Ctrl+C to shut down.
stdout: BridgeConnector connected!
stdout: info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
Request starting HTTP/1.1 GET http://localhost:8001/
stdout: info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
Executing endpoint 'Fallback {path:nonfile}'
stdout: info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'Fallback {
path:nonfile}'
stdout: info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished in 29.200300000000002ms 404
C:UsersMahersourcereposWebApplication20WebApplication20.ServerobjHostnode_modules.bin>

Any luck with this yet?

I spent a few hours yesterday digging into this issue, and I figured it out. It really has nothing to do with Electron.NET, and everything to do with the changes they made to the Endpoint Routing. With the Preview 6 changes, not all of the files were exposed to the Host, and the ones that were weren't in the right spot.

After a few hours of testing, I was able to get everything working and into a NuGet package that could handle the changes. I didn't make a PR here yet because it requires VS2019, and I didn't want to force that upgrade on the project without asking. So for now, it's in my own repo.

If you get a chance, please test it out (instructions are on the repo home page) and let me know if it works for you. Then we can discuss if it needs to move.

Thanks!

@robertmclaws I really appreciate your great effort digging into this issue.
It works like a charm !

image

Thanks !

Since this was not an Electron.NE issue, but an ASP.NET Core routing issue, you can feel free to close this bug.

@robertmclaws Thank you very much for your support!

The native Blazor support in Electron.NET is important to us. Can you please submit your PR.

Nice work @robertmclaws, it would be cool if this would be in the standard extensions provided by electron.net.

Excuse my ignorance but I cannot see the pull request fixing this issue.

That's because one is no longer required. Either Microsoft or this team fixed the issue, and the package is no longer necessary. I've updated ElectronNET.Blazor for Preview 7 to restore the original behavior without breaking anyone who already installed it. I'm not recommending anyone remove it yet, in case something breaks between now and Blazor RTM, but I'll put a note in the readme.txt file when it's safe to uninstall the package.

@robertmclaws Thank you for the answer.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GregorBiswanger picture GregorBiswanger  路  4Comments

Marcelh1983 picture Marcelh1983  路  5Comments

BrianAllred picture BrianAllred  路  5Comments

robalexclark picture robalexclark  路  6Comments

philiphobgen picture philiphobgen  路  3Comments