Skip to content

Fails to start with VSCode #952

Closed
Closed

Description

@markatosi
  • 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

Activity

  1. FlorianRappl commented on Nov 26, 2025

    @FlorianRappl
    Collaborator

    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?

  2. markatosi commented on Nov 26, 2025

    @markatosi
    ContributorAuthor

    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

  3. markatosi commented on Nov 26, 2025

    @markatosi
    ContributorAuthor

    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.

  4. added this to the 0.3.0 milestone on Nov 26, 2025
  5. FlorianRappl commented on Dec 9, 2025

    @FlorianRappl
    Collaborator

    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!

  6. markatosi commented on Dec 9, 2025

    @markatosi
    ContributorAuthor

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

  7. markatosi commented on Dec 11, 2025

    @markatosi
    ContributorAuthor
  8. markatosi commented on Dec 12, 2025

    @markatosi
    ContributorAuthor

    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

  9. FlorianRappl commented on Dec 13, 2025

    @FlorianRappl
    Collaborator

    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.

  10. removed this from the 0.3.0 milestone on Dec 13, 2025
  11. markatosi commented on Dec 13, 2025

    @markatosi
    ContributorAuthor

    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

  12. added this to the 0.3.0 milestone on Dec 13, 2025
  13. FlorianRappl commented on Dec 13, 2025

    @FlorianRappl
    Collaborator

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

  14. FlorianRappl commented on Dec 14, 2025

    @FlorianRappl
    Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions