Fails to start with VSCode
- 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:
- Try to run application in VSCode via c# dev kit Solution explorer
- Right click project and select Debug | Start New Instance
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?
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
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.
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!
Hi Florian, I’ll post the project in the next couple of days. I’m on a plane for the next day or so.
https://github.com/markatosi/BlazorApp1
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
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.
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
Alright thanks - I can actually reproduce it. Will be fixed in 0.3.0.
Fixed with most recent preview (0.3.0-pre.4).