dotnet / dotnet/sdk

dotnet watch fails with "Unable to apply hot reload due to compilation errors." and no actionable error messages, on a previously working project

Open
#50,716 10 comments 1 reaction 0 assignees View on GitHub
Area-Watch needs-info untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

`dotnet watch` fails with message "Unable to apply hot reload due to compilation errors." on the first code change, even if it's just spacing changes, with no further errors or information. it always builds successfully on startup and then fails all further updates. this is new in our codebase. this is happening on at least 9.0.304+. It is NOT broken on mac/arm64 for whatever reason.

can't share closed source code but it seems to have started happening on an edit to a long autogenerated enum (2611 elements as of now) (built by a bash script, not any part of the msbuild plumbing, and not actively running during watch scsript) but since it compiles and runs fine in normal builds, and first watch build, i don't think there is anything actually Wrong with that file? Just a potential clue idk.

reverting to sdk 8.0.414 fixes the issue

Searching for the error message brought me to this commit, not sure if it's helpful but it seems to be a recent change?
https://github.com/dotnet/sdk/commit/7bccb4e36a316c421a158b82546b2c5e94cc8ff9

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.