-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
SDK version
9.0.203
Environment
MacOS 15.4
Apple M4
Reproduction
- Call
dotnet new web
- Call
dotnet watch run --non-interactive
and open the local server in a browser - change the return type of the default
/
GET handler (e.g. fromapp.MapGet("/", () => "Hello World!");
toapp.MapGet("/", () => 1);
and save the file - refresh the page
Expectation
Step 3 detects the change as a "rude edit" and restarts the application, step 4 shows the new output in the browser
Reality
Step 3 detects the edit and writes this output to the console:
dotnet watch ⌚ File updated: ./Program.cs
dotnet watch 🔥 [dotnet (net9.0)] Hot reload succeeded.
Step 4 fails and the console gets this error message:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.Runtime.CompilerServices.HotReloadException: Attempted to invoke lambda or local function with an unsupported change made while the application is running: /Users/denis/git/dotnet/Program.cs(4,17): error ENC0054: Changing the return type of lambda requires restarting the application.
at Program.<>c.<<Main>$>b__0_0()
at lambda_method1(Closure, Object, HttpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
Additional info
This behavior was behaving in line with expectations on SDK version 6.0.400, even without the --non-interactive
flag