Skip to content

"hotReloadEnabled": false does not work #27182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ronniebarker opened this issue Aug 14, 2022 · 7 comments
Open

"hotReloadEnabled": false does not work #27182

ronniebarker opened this issue Aug 14, 2022 · 7 comments
Labels
Area-Watch untriaged Request triage from a team member

Comments

@ronniebarker
Copy link

Description

Even with "hotReloadEnabled": false in launchSettings.json, hot reload still seems to activate which is particularly annoying when using ASP.NET and EF and AutoMapper where things that get configured at the start can recompile and hot reload, but the effect doesn't take effect - I have wasted many hours since upgrading to v6 with the code I am running not actually being the code I have written :-(

Reproduction Steps

  1. Put "hotReloadEnabled": false in launchSettings.json
  2. Run dotnet watch run
  3. Change some simple code
  4. Hot reload happens when it shouldn't

Expected behavior

Code rebuilds

Actual behavior

Hot reload

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@ghost
Copy link

ghost commented Aug 14, 2022

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost added the untriaged Request triage from a team member label Aug 14, 2022
@hez2010
Copy link

hez2010 commented Aug 14, 2022

As a workaround, if you don't want hot reload, you may simply run dotnet run without watch.

@ghost
Copy link

ghost commented Aug 14, 2022

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Even with "hotReloadEnabled": false in launchSettings.json, hot reload still seems to activate which is particularly annoying when using ASP.NET and EF and AutoMapper where things that get configured at the start can recompile and hot reload, but the effect doesn't take effect - I have wasted many hours since upgrading to v6 with the code I am running not actually being the code I have written :-(

Reproduction Steps

  1. Put "hotReloadEnabled": false in launchSettings.json
  2. Run dotnet watch run
  3. Change some simple code
  4. Hot reload happens when it shouldn't

Expected behavior

Code rebuilds

Actual behavior

Hot reload

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Author: ronniebarker
Assignees: -
Labels:

area-Diagnostics-coreclr, untriaged

Milestone: -

@tommcdon tommcdon transferred this issue from dotnet/runtime Aug 15, 2022
@chocotree
Copy link

According to the document at doc: aspnetcore-7.0#disable-hot-reload, the setting hotReloadEnabled: false is not working for me.

Here is the demo:

hot_reload_not_setting_not_work.mp4

Here is my dotnet info:
dotnet --info
.NET SDK:
 Version:   7.0.103
 Commit:    276c71d299

執行階段環境:
 OS Name:     Mac OS X
 OS Version:  12.2
 OS Platform: Darwin
 RID:         osx.12-arm64
 Base Path:   /usr/local/share/dotnet/sdk/7.0.103/

Host:
  Version:      7.0.3
  Architecture: arm64
  Commit:       0a2bda10e8

.NET SDKs installed:
  5.0.102 [/usr/local/share/dotnet/sdk]
  6.0.406 [/usr/local/share/dotnet/sdk]
  7.0.103 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

@rhyek
Copy link

rhyek commented Oct 23, 2023

Just tested this on 8.0.100-rc.2.23502.2 and I am seeing the same behavior. My use case is I want to be able to run the program in watch mode and have any change always restart the program without worrying about what type of changes are/aren't supported by hot reload.

The hotReloadEnabled setting in launchSettings.json does not work, but using the flag does: dotnet watch --no-hot-reload run.

@daiplusplus
Copy link

daiplusplus commented May 24, 2024

I had this problem again just now (using VS2022 LTSC 17.8.10), and it wasn't working after I copied-and-pasted the line, but then VS flagged the JSON for not using a quoted property name, which was a headscratcher for a moment...

image

...if you look very closely you can see it's using fancy quotes (U+201C and U+201D) and instead of ASCII 0x22 Double Quotes "

Spot the difference:

“hotReloadEnabled”: false
"hotReloadEnabled": false

(I'm on a 192dpi 2x display, so because the pixel-grid is finer it means typeface hinting doesn't make the difference between the quote chars immediately obvious - if you're on a 96dpi display or using a different font then I suppose it might be more obvious (or perhaps even less obvious?)

After fixing that it seemed to correctly disable the whole script-injection feature - but I'm still left with a bad taste in my mouth: surely in a web project the user's generated HTML markup is sacrosanct - I'm fine with VS+Debugging tools injecting helper scripts, but doing it by-default and needing to flip several other switches too gives me the impression I'll to do this all-over-again in some future VS version (and besides, if I wanted gratuitous script injections I'd be using WebForms...)

...so with that in mind, I'd like to make 2 suggestions:

  1. Add a single setting that disables all kinds of runtime HTML injection, so we don't need to hunt down each individual option (for CSS Hot Reload, Blazor Hot Reload, Browser Page Refresh, etc).
  2. Add a HTML comment to the injected HTML that includes instructions for changing that "Disable all HTML injection" option, instead of a naked <script> element with no explainer.

@Adomas-Alimas
Copy link

Adomas-Alimas commented Feb 22, 2025

Encountered the same issue running .NET 9.0.101. Setting "hotReloadEnabled": false as mentioned in the official docs does nothing. Only running watch with flag like this works: dotnet watch --no-hot-reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Watch untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

8 participants