Fails to start with VSCode #1022

Closed
opened 2026-01-29 16:55:25 +00:00 by claunia · 11 comments
Owner

Originally created by @markatosi on GitHub (Nov 25, 2025).

  • 0.2:
  • .Net 10:

Application fails to start when running through VSCode using Run and Debug with c# Dev kit

GatherBuildInfo: No testhost detected: BlazorApp1
Probe scored for launch origin:   DotNet 3 vs. 0 Electron
Probe scored for package mode:   Unpackaged 4 vs. 0 Packaged
Evaluated StartupMethod: UnpackedDotnetFirst
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware[0]
      Middleware loaded
Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware: Debug: Middleware loaded
Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware: Debug: Middleware loaded. Script /_framework/aspnetcore-browser-refresh.js (16459 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/aspnetcore-browser-refresh.js (16459 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/blazor-hotreload.js (799 B).
Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware: Debug: Middleware loaded. Script /_framework/blazor-hotreload.js (799 B).
[StartInternal]: startCmd: /Volumes/Repos_APFS/source/electron/BlazorApp1/bin/Debug/net10.0/osx-arm64/.electron/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron
[StartInternal]: args: main.js -unpackeddotnet --trace-warnings -electronforcedport=8002 /Volumes/Repos_APFS/source/electron/BlazorApp1/bin/Debug/net10.0/osx-arm64/BlazorApp1.dll
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[0]
      Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true
Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware: Debug: Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:8003
Microsoft.Hosting.Lifetime: Information: Now listening on: http://localhost:8003
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
Microsoft.Hosting.Lifetime: Information: Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /Volumes/Repos_APFS/source/electron/BlazorApp1
Microsoft.Hosting.Lifetime: Information: Content root path: /Volumes/Repos_APFS/source/electron/BlazorApp1
|| /Volumes/Repos_APFS/source/electron/BlazorApp1/bin/Debug/net10.0/osx-arm64/.electron/main.js:28
|| if (app.commandLine.hasSwitch('manifest')) {
||         ^
|| 
|| TypeError: Cannot read properties of undefined (reading 'commandLine')
||     at Object.<anonymous> (/Volumes/Repos_APFS/source/electron/BlazorApp1/bin/Debug/net10.0/osx-arm64/.electron/main.js:28:9)
||     at Module._compile (node:internal/modules/cjs/loader:1714:14)
||     at Module._extensions..js (node:internal/modules/cjs/loader:1848:10)
||     at Module.load (node:internal/modules/cjs/loader:1448:32)
||     at Module._load (node:internal/modules/cjs/loader:1270:12)
||     at c._load (node:electron/js2c/node_init:2:17993)
||     at TracingChannel.traceSync (node:diagnostics_channel:322:14)
||     at wrapModuleLoad (node:internal/modules/cjs/loader:244:24)
||     at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:186:5)
||     at node:internal/main/run_main_module:36:49
|| 
|| Node.js v22.19.0
[StartInternal]: after run:
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
Microsoft.Hosting.Lifetime: Information: Application is shutting down...
2
[StartInternal]: Process is not running: 
2
[StartInternal]: Exception: 
[StartInternal]: Exception: System.Exception: Failed to launch the Electron process.
   at ElectronNET.Runtime.Services.ElectronProcess.ElectronProcessActive.StartInternal(String startCmd, String args, String directoriy)
The program '[87635] BlazorApp1' has exited with code 0 (0x0).

Steps to Reproduce:

  1. Try to run application in VSCode via c# dev kit Solution explorer
  2. Right click project and select Debug | Start New Instance
Originally created by @markatosi on GitHub (Nov 25, 2025). <!-- Please search existing issues to avoid creating duplicates. --> <!-- Which version of Electron.NET CLI and API are you using? --> <!-- Please always try to use latest version before report. --> * **0.2**: <!-- Which version of .NET Core and Node.js are you using (if applicable)? --> <!-- What target are you building for? --> * **.Net 10**: <!-- Enter your issue details below this comment. --> Application fails to start when running through VSCode using Run and Debug with c# Dev kit ``` GatherBuildInfo: No testhost detected: BlazorApp1 Probe scored for launch origin: DotNet 3 vs. 0 Electron Probe scored for package mode: Unpackaged 4 vs. 0 Packaged Evaluated StartupMethod: UnpackedDotnetFirst dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware[0] Middleware loaded Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware: Debug: Middleware loaded Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware: Debug: Middleware loaded. Script /_framework/aspnetcore-browser-refresh.js (16459 B). dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0] Middleware loaded. Script /_framework/aspnetcore-browser-refresh.js (16459 B). dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0] Middleware loaded. Script /_framework/blazor-hotreload.js (799 B). Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware: Debug: Middleware loaded. Script /_framework/blazor-hotreload.js (799 B). [StartInternal]: startCmd: /Volumes/Repos_APFS/source/electron/BlazorApp1/bin/Debug/net10.0/osx-arm64/.electron/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron [StartInternal]: args: main.js -unpackeddotnet --trace-warnings -electronforcedport=8002 /Volumes/Repos_APFS/source/electron/BlazorApp1/bin/Debug/net10.0/osx-arm64/BlazorApp1.dll dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[0] Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware: Debug: Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true info: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:8003 Microsoft.Hosting.Lifetime: Information: Now listening on: http://localhost:8003 Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development Microsoft.Hosting.Lifetime: Information: Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: /Volumes/Repos_APFS/source/electron/BlazorApp1 Microsoft.Hosting.Lifetime: Information: Content root path: /Volumes/Repos_APFS/source/electron/BlazorApp1 || /Volumes/Repos_APFS/source/electron/BlazorApp1/bin/Debug/net10.0/osx-arm64/.electron/main.js:28 || if (app.commandLine.hasSwitch('manifest')) { || ^ || || TypeError: Cannot read properties of undefined (reading 'commandLine') || at Object.<anonymous> (/Volumes/Repos_APFS/source/electron/BlazorApp1/bin/Debug/net10.0/osx-arm64/.electron/main.js:28:9) || at Module._compile (node:internal/modules/cjs/loader:1714:14) || at Module._extensions..js (node:internal/modules/cjs/loader:1848:10) || at Module.load (node:internal/modules/cjs/loader:1448:32) || at Module._load (node:internal/modules/cjs/loader:1270:12) || at c._load (node:electron/js2c/node_init:2:17993) || at TracingChannel.traceSync (node:diagnostics_channel:322:14) || at wrapModuleLoad (node:internal/modules/cjs/loader:244:24) || at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:186:5) || at node:internal/main/run_main_module:36:49 || || Node.js v22.19.0 [StartInternal]: after run: info: Microsoft.Hosting.Lifetime[0] Application is shutting down... Microsoft.Hosting.Lifetime: Information: Application is shutting down... 2 [StartInternal]: Process is not running: 2 [StartInternal]: Exception: [StartInternal]: Exception: System.Exception: Failed to launch the Electron process. at ElectronNET.Runtime.Services.ElectronProcess.ElectronProcessActive.StartInternal(String startCmd, String args, String directoriy) The program '[87635] BlazorApp1' has exited with code 0 (0x0). ``` <!-- If you want, you can donate to increase issue priority (https://donorbox.org/electron-net) --> Steps to Reproduce: 1. Try to run application in VSCode via c# dev kit Solution explorer 2. Right click project and select Debug | Start New Instance
claunia added the bugdev-experience labels 2026-01-29 16:55:25 +00:00
Author
Owner

@FlorianRappl commented on GitHub (Nov 26, 2025):

Not sure if VS code is the issue... From the logs I see that you run it on MacOS.

What's your npm (and Node.js) version?

@FlorianRappl commented on GitHub (Nov 26, 2025): Not sure if VS code is the issue... From the logs I see that you run it on MacOS. What's your npm (and Node.js) version?
Author
Owner

@markatosi commented on GitHub (Nov 26, 2025):

npm 10.9.0
node v22.12.0

Yes I'm on a mac when i'm not using VS Studio 2026 on win 11 in Parallels. On the mac host I use Jetbrains Rider 99.99% of the time.

This was just a test in vs code to see what would happen. I'm a vs code noob so I could be doing something wrong but I
just started the app the way Microsoft recommends one starts c# apps in vs code with the dev kit.

Works fine in Rider of course.

I guess if anyone else can start the app properly from vs code on a mac then we can point the finger at me for now knowing what I'm doing :-)

https://code.visualstudio.com/docs/csharp/debugging

@markatosi commented on GitHub (Nov 26, 2025): npm 10.9.0 node v22.12.0 Yes I'm on a mac when i'm not using VS Studio 2026 on win 11 in Parallels. On the mac host I use Jetbrains Rider 99.99% of the time. This was just a test in vs code to see what would happen. I'm a vs code noob so I could be doing something wrong but I just started the app the way Microsoft recommends one starts c# apps in vs code with the dev kit. Works fine in Rider of course. I guess if anyone else can start the app properly from vs code on a mac then we can point the finger at me for now knowing what I'm doing :-) https://code.visualstudio.com/docs/csharp/debugging
Author
Owner

@markatosi commented on GitHub (Nov 26, 2025):

In the log message it's mentioning node v22.19 which is not installed on my machine. The wiki just says to have node 22.x or later. At any rate i have now updated to node v22.21.1

No change. rider still works, vscode doesn't.

dotnet run works as usual.

@markatosi commented on GitHub (Nov 26, 2025): In the log message it's mentioning node v22.19 which is not installed on my machine. The wiki just says to have node 22.x or later. At any rate i have now updated to node v22.21.1 No change. rider still works, vscode doesn't. dotnet run works as usual.
Author
Owner

@FlorianRappl commented on GitHub (Dec 9, 2025):

I just tried this and everything seems to work fine. Can you provide your project in form of a repository on GitHub? This would help reproducing / identifying the issue. Many thanks!

@FlorianRappl commented on GitHub (Dec 9, 2025): I just tried this and everything seems to work fine. Can you provide your project in form of a repository on GitHub? This would help reproducing / identifying the issue. Many thanks!
Author
Owner

@markatosi commented on GitHub (Dec 9, 2025):

Hi Florian, I’ll post the project in the next couple of days. I’m on a plane for the next day or so.

@markatosi commented on GitHub (Dec 9, 2025): Hi Florian, I’ll post the project in the next couple of days. I’m on a plane for the next day or so.
Author
Owner

@markatosi commented on GitHub (Dec 11, 2025):

https://github.com/markatosi/BlazorApp1

@markatosi commented on GitHub (Dec 11, 2025): https://github.com/markatosi/BlazorApp1
Author
Owner

@markatosi commented on GitHub (Dec 12, 2025):

I removed the Blazor1 repo and created Blazor2 as Blazor1 was full of junk that didn't need to be there.

https://github.com/markatosi/BlazorApp2

@markatosi commented on GitHub (Dec 12, 2025): I removed the Blazor1 repo and created Blazor2 as Blazor1 was full of junk that didn't need to be there. https://github.com/markatosi/BlazorApp2
Author
Owner

@FlorianRappl commented on GitHub (Dec 13, 2025):

I am confused. The project does not use Electron.NET or integrate it at all. So I'll need to close this one unless you provide a MWE to reproduce your issue with Electron.NET.

@FlorianRappl commented on GitHub (Dec 13, 2025): I am confused. The project does not use Electron.NET or integrate it at all. So I'll need to close this one unless you provide a MWE to reproduce your issue with Electron.NET.
Author
Owner

@markatosi commented on GitHub (Dec 13, 2025):

Sorry about that i did the initial commit and made the additions to add electron.net then got pulled away on something else and forgot to commit the new update. It's there now

@markatosi commented on GitHub (Dec 13, 2025): Sorry about that i did the initial commit and made the additions to add electron.net then got pulled away on something else and forgot to commit the new update. It's there now
Author
Owner

@FlorianRappl commented on GitHub (Dec 13, 2025):

Alright thanks - I can actually reproduce it. Will be fixed in 0.3.0.

@FlorianRappl commented on GitHub (Dec 13, 2025): Alright thanks - I can actually reproduce it. Will be fixed in 0.3.0.
Author
Owner

@FlorianRappl commented on GitHub (Dec 14, 2025):

Fixed with most recent preview (0.3.0-pre.4).

@FlorianRappl commented on GitHub (Dec 14, 2025): Fixed with most recent preview (0.3.0-pre.4).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#1022