aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

For a "dotnet new web" project, if you try to make a change and hit save, you will not see the change even if you force refresh the browser

Open MacdonaldRobinson opened this issue 3 years ago • 7 comments

Describe the bug

Hot Reload doesn't work when you create a new endpoint using minimal API, it doesn't even rebuild and refresh the browser, and when you force refresh the browser the changes are still not reflected.

image

To Reproduce

  • In WSL - Ubuntu 20.04 LTS
  • Create a new web app using "dotnet new web"
  • Use "code ." to open it in VS Code
  • In the Terminal type "dotnet watch"
  • Open the link in the browser
  • Open Project.cs
  • Create a new endpoint OR update the existing "Hello World" text
  • Hit CTRL+S
  • You will see the message "No hot reload changes to apply. Application restarting because changes were detected to the app's initialization code."
  • At this point you would assume the changes have been reflected in the browser.
  • If you goto the browser, it has not refreshed, and if you force refresh the browser, you will still not see the changes.

Further technical details

  • Output of dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.100-preview.5.21302.13 Commit: d6380bcae7

Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-x64 Base Path: /home/mac/dotnet/sdk/6.0.100-preview.5.21302.13/

Host (useful for support): Version: 6.0.0-preview.5.21301.5 Commit: ec3e0b276b

.NET SDKs installed: 6.0.100-preview.5.21302.13 [/home/mac/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.0-preview.5.21301.17 [/home/mac/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.0-preview.5.21301.5 [/home/mac/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download

  • The IDE: VS Code image

MacdonaldRobinson avatar Jun 20 '21 20:06 MacdonaldRobinson

Thanks for contacting us.

We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

ghost avatar Jun 21 '21 16:06 ghost

Thanks for contacting us. Adding a new endpoint is not going to work as it's not supported at the moment. Modifying existing endpoint will work. This is something we will be looking at addressing potentially in .NET 7 timeframe.

mkArtakMSFT avatar Aug 12 '21 21:08 mkArtakMSFT

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Aug 12 '21 21:08 ghost

@mkArtakMSFT Is it possible to restart the app if these code changes are unsupported when running dotnet watch run ? For now (6.0.0-rc.1), it still reload the app but no effect.

doggy8088 avatar Sep 16 '21 05:09 doggy8088

This still seem to be an issue. To get around the issue I usually just hit ctrl-r in the dotnet watch terminal. The problem with this is that the injected browser refresh middleware do not seem to notice the manual refresh so I have to manually refresh the browser as well.

BlueManiac avatar Mar 13 '23 17:03 BlueManiac

Related: https://github.com/dotnet/aspnetcore/issues/47836

szalapski avatar Jun 05 '23 16:06 szalapski

Try disabling the hor reload by entering the dotnet watch run command with the --no-hot-reload flag.

JulzDave avatar Mar 13 '24 14:03 JulzDave