Skip to content

[dotnet watch with hot reload]There is an error "Exited with error code -1" when pressing Ctrl+C to exit dotnet-watch for Blazor wasm standalone project after installing 10.0 RTM #64071

@jinzhao1127

Description

@jinzhao1127

REGRESSION INFO: Works well on 10.0 Preview 6

INSTALL STEPS:

  1. Install Latest 10.0 RTM from .NET - Release Tracker
  2. Apply Feed and do feed workaround.

Platform

  • Windows
  • macOS
  • Linux

Repro Steps

  1. Open up a normal Command Prompt (Terminal)
  2. Create a Blazor wasm Standalone app and run it.
    dotnet new blazorwasm -o WasmStand
    cd WasmStand
    dotnet watch
    
  3. The project will automatically open in browser.
  4. Back to the Command Prompt and click Ctrl + C to exit dotnet-watch

Actual Result

There is an error when pressing Ctrl+C to exit dotnet-watch
Image

Error Log
dotnet watch ❌ [WasmStand (net10.0)] Exited with error code -1

C:\Users\v-zhajin\WasmStand>dotnet watch --verbose
dotnet watch ⌚ Working directory: 'C:\Users\v-zhajin\WasmStand'
dotnet watch ⌚ Watching with Hot Reload.
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
dotnet watch 💡 Press Ctrl+R to restart.
dotnet watch 🔨 Building C:\Users\v-zhajin\WasmStand\WasmStand.csproj ...
dotnet watch 🚀 Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments 'build C:\Users\v-zhajin\WasmStand\WasmStand.csproj -consoleLoggerParameters:NoSummary;Verbosity=minimal --property:NuGetInteractive=true': process id 4200
dotnet watch ⌚ Process id 4200 ran for 3138ms and exited with exit code 0.
dotnet watch 🔨 Build succeeded: C:\Users\v-zhajin\WasmStand\WasmStand.csproj
dotnet watch 🔨   Determining projects to restore...
dotnet watch 🔨   All projects are up-to-date for restore.
dotnet watch 🔨   WasmStand -> C:\Users\v-zhajin\WasmStand\bin\Debug\net10.0\WasmStand.dll
dotnet watch 🔨   WasmStand (Blazor output) -> C:\Users\v-zhajin\WasmStand\bin\Debug\net10.0\wwwroot
dotnet watch 🔨
dotnet watch 🔨 Build succeeded.
dotnet watch 🔨     0 Warning(s)
dotnet watch 🔨     0 Error(s)
dotnet watch 🔨
dotnet watch 🔨 Time Elapsed 00:00:02.83
dotnet watch ⌚ Watching 65 file(s) for changes
dotnet watch ⌚ Exclusion glob: '**\node_modules\**;node_modules\**;**\jspm_packages\**;jspm_packages\**;**\bower_components\**;bower_components\**;**\packages.lock.json;bin\Debug\/**;obj\Debug\/**;bin\/**;obj\/**;**/*.user;**/*.*proj;**/*.sln;**/*.slnx;**/*.vssscc;**/.DS_Store' under project 'C:\Users\v-zhajin\WasmStand'
dotnet watch ⌚ Application kind: BlazorWebAssembly.
dotnet watch 🔃 [WasmStand (net10.0)] Using browser-refresh middleware
dotnet watch 🔃 [WasmStand (net10.0)] Refresh server running at wss://localhost:56589,ws://localhost:56590.
dotnet watch 🔥 [WasmStand (net10.0)] Project specifies capabilities: 'Baseline AddMethodToExistingType AddStaticFieldToExistingType NewTypeDefinition ChangeCustomAttributes AddInstanceFieldToExistingType GenericAddMethodToExistingType GenericUpdateMethod UpdateParameters GenericAddFieldToExistingType'
dotnet watch ⌚ dotnet-watch is configured to launch a browser on ASP.NET Core application startup.
dotnet watch 🚀 [WasmStand (net10.0)] Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments 'run --no-build -e DOTNET_WATCH=1 -e DOTNET_WATCH_ITERATION=1 -e "HOTRELOAD_DELTA_CLIENT_LOG_MESSAGES=dotnet watch 🕵️ [WasmStand (net10.0)]" -e ASPNETCORE_AUTO_RELOAD_WS_ENDPOINT=wss://localhost:56589,ws://localhost:56590 -e ASPNETCORE_AUTO_RELOAD_WS_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq6CPpMUr3nriskem3Y7jqNP5BDvU7X/wnP1zxnJ5NdcszWw9ha0uZNByRA5EHB3HDLxxq6rbbQmwa1z8mPosuxM4OlQV3fl8MUMRiQwVvMVWnA8u1QHPls4CWhqcRMxifj6+YDCz+8bFc3LSmas+/ruyyflqFbw5Hba3L3Xy32o8axM9zxSv8Jz60hvpYVZDacshapUEwjiInTC7ItzWUVOkZP9H7RMBsjFwk0J8cVU/INO0yXq3E1iXZUSJFqDZ9NS6HwH3Z3HcHTFg6fqV+pOYtnFk2i7pTIQwUrAAR69+KEFp+1PzAeEujtww4Uv2jTQ1iLmLK7ND2RkWht2TTQIDAQAB -e ASPNETCORE_AUTO_RELOAD_VDIR=/ -e "DOTNET_STARTUP_HOOKS=C:\Program Files\dotnet\sdk\10.0.100\DotnetTools\dotnet-watch\10.0.100\tools\net10.0\any\hotreload\net6.0\Microsoft.AspNetCore.Watch.BrowserRefresh.dll" -e ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=Microsoft.AspNetCore.Watch.BrowserRefresh -e DOTNET_MODIFIABLE_ASSEMBLIES=debug -e Logging__LogLevel__Microsoft.AspNetCore.Watch=Debug': process id 1228
Using launch settings from C:\Users\v-zhajin\WasmStand\Properties\launchSettings.json...
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware[0]
      Middleware loaded
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/aspnetcore-browser-refresh.js (16481 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/blazor-hotreload.js (799 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[0]
      Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5047
dotnet watch ⌚ Launching browser: http://localhost:5047
dotnet watch 🚀 Launched 'http://localhost:5047' with arguments '': process id 3372
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\v-zhajin\WasmStand
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[1]
      Response markup is scheduled to include browser refresh script injection.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[2]
      Response markup was updated to include browser refresh script injection.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Script injected: /_framework/aspnetcore-browser-refresh.js
dotnet watch 🌐 [Browser #1] Connected to refresh server.
dotnet watch 🔥 Hot reload session started.
dotnet watch ⌚ Waiting for changes
dotnet watch 🛑 Shutdown requested. Press Ctrl+C again to force exit.
dotnet watch ⌚ Terminating remaining child processes.
dotnet watch ⌚ [WasmStand (net10.0)] Terminating process 1228 (Ctrl+C).
dotnet watch ⌚ [WasmStand (net10.0)] Waiting for process 1228 to exit within 5s.
dotnet watch ⌚ [WasmStand (net10.0)] Terminating process 1228 (Kill).
dotnet watch ⌚ [WasmStand (net10.0)] Process id 1228 ran for 13116ms and exited with exit code -1.
dotnet watch ❌ [WasmStand (net10.0)] Exited with error code -1
dotnet watch 🌐 [Browser #1] Disconnected

Expected Result
It should not any error after type Ctrl+C

Image

Note:

  1. This issue only repro on Blazor wasm Standalone app, does not repro on MVC/Blazor Web App.
  2. This issue also reproduces on 9.0/8.0 Blazor wasm Standalone app after installing 10.0 RTM
  3. For 10.0 RC 2 was blocked by https://github.com/dotnet/AspNetCore-ManualTests/issues/3718

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions