question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hot reload doesn't work on F5 but works when run `dotnet watch`

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hot reload doesn’t work on a simple ASP.NET 6 app, when I run it with F5. My launchSettings.json is configured like this:


    "Kestrel": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "hotReloadEnabled": true,
      "applicationUrl": "https://outvers:3422;http://outvers:3420"
    },

Whenever I do a simple change in the .cshtml file hot reload doesn’t work.

But if I run the app using the dotnet watch command, then it works as expected.

I see that the output of the dotnet watch command differs from F5.

F5 output:

'Buddy.OutversService.exe' (CoreCLR: clrhost): Loaded 'D:\Repos\Buddy.OutversService\OutversService\bin\Debug\net6.0\Buddy.OutversService.dll'. Symbols loaded.
...
Microsoft.Hosting.Lifetime: Information: Now listening on: https://[::]:3422
Microsoft.Hosting.Lifetime: Information: Now listening on: http://[::]:3420
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.
Microsoft.Hosting.Lifetime: Information: Hosting environment: Development
Microsoft.Hosting.Lifetime: Information: Content root path: D:\Repos\Buddy.OutversService\OutversService
The thread 0x9bd8 has exited with code 0 (0x0).
The thread 0xdeb8 has exited with code 0 (0x0).
The thread 0x6620 has exited with code 0 (0x0).
The thread 0xdae8 has exited with code 0 (0x0).
The thread 0xe22c has exited with code 0 (0x0).
The thread 0xa53c has exited with code 0 (0x0).
The thread 0x3230 has exited with code 0 (0x0).
The thread 0xd0a8 has exited with code 0 (0x0).
The thread 0xa618 has exited with code 0 (0x0).
The thread 0x7d18 has exited with code 0 (0x0).
The thread 0xd4b0 has exited with code 0 (0x0).
The program '[400] Buddy.OutversService.exe' has exited with code 4294967295 (0xffffffff).

dotnet watch output:

...
  OutversService -> D:\Repos\Buddy.OutversService\OutversService\bin\Debug\net6.0\Buddy.OutversService.dll
watch : Started
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://[::]:3422
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://[::]:3420
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: D:\Repos\Buddy.OutversService\OutversService
**watch : File changed: D:\Repos\Buddy.OutversService\OutversService\Pages\ConsentPage.cshtml.**
**watch : Hot reload of changes succeeded.**

Expected Behavior

Hot reload should work when cshtml file is changed

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

6.0.200-preview.21617.4

Anything else?

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
mkArtakMSFTcommented, Mar 23, 2022

@nZeus can you please try out the next preview release of VS and confirm whether the issue still reproes for you or not.

0reactions
nZeuscommented, Mar 24, 2022

I’ve upgraded to 17.2.0-pre.2.1 and it seems to work properly now 👍 Thank you 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hot reload blazor via dotnet watch not working
I am starting the application either by ctrl+f5 or dotnet watch via CLI but neither are working =( – lioleveau. Dec 20, 2021...
Read more >
Weird errors problem with dotnet watch with blazor/wasm.
I start the API part with CTRL+F5, and I start the Blazor part from the Windows terminal with dotnet watch (because I want...
Read more >
Hot Reload not so hot. : r/Blazor
I started it through the dotnet watch run command and hot reload worked fine for blazor server and wasm. skill issue maybe?
Read more >
dotnet watch run doesnt reload browser - Umbraco 9
Sounds like the feature that you want is in .NET 6.0+ which is called Hot Reload. You can try it now by using...
Read more >
Edit running code with Hot Reload - JetBrains Rider
Hot Reload, also known as Edit & Continue. Learn how to make changes while running and debugging without restarting the session.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found