Skip to content

Warn when MetadataUpdaterSupport is false in dotnet watch#54264

Open
jonathanpeppers wants to merge 1 commit into
release/10.0.4xxfrom
jonathanpeppers/dotnet-watch-metadata-updater-warning
Open

Warn when MetadataUpdaterSupport is false in dotnet watch#54264
jonathanpeppers wants to merge 1 commit into
release/10.0.4xxfrom
jonathanpeppers/dotnet-watch-metadata-updater-warning

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

Add the same hot reload support check for MetadataUpdaterSupport that already exists for StartupHookSupport. When MetadataUpdaterSupport is false (e.g. non-Debug configurations), dotnet watch now warns that the project does not support Hot Reload and suggests setting the property to True.

Changes

  • BuildNames.cs — Added MetadataUpdaterSupport constant
  • HotReloadAppModel.cs — Added a check: if MetadataUpdaterSupport is false, logs ProjectDoesNotSupportHotReload_Property warning and returns false. Includes a link to the CoreCLR MetadataUpdater.cs source.
  • SourceFileUpdateTests.HotReloadNotSupported.cs — Added [InlineData("MetadataUpdaterSupport", "False")] test case

Copilot AI review requested due to automatic review settings May 12, 2026 14:14
@jonathanpeppers jonathanpeppers requested review from a team and tmat as code owners May 12, 2026 14:14
@jonathanpeppers jonathanpeppers changed the base branch from main to release/10.0.4xx May 12, 2026 14:15
@jonathanpeppers jonathanpeppers requested review from a team as code owners May 12, 2026 14:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@jonathanpeppers jonathanpeppers force-pushed the jonathanpeppers/dotnet-watch-metadata-updater-warning branch from 4721673 to 46550c8 Compare May 12, 2026 14:16
Add the same hot reload support check for MetadataUpdaterSupport that
already exists for StartupHookSupport. When MetadataUpdaterSupport is
false (e.g. Release configuration), dotnet watch now warns that the
project does not support Hot Reload and suggests setting the property
to True.

Also adds a test case for MetadataUpdaterSupport=False alongside the
existing StartupHookSupport test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers force-pushed the jonathanpeppers/dotnet-watch-metadata-updater-warning branch from 46550c8 to e990aac Compare May 12, 2026 14:17
@tmat
Copy link
Copy Markdown
Member

tmat commented May 12, 2026

Note that when PublishTrimmed is true the value of MetadataUpdaterSupport used to be false even in debug build. This was fixed by dotnet/runtime#127163

Copy link
Copy Markdown
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the fix dotnet/runtime#127163 only targets .NET 11 runtime. Instead of checking MetadataUpdaterSupport we might need to check Optimize and DebugType properties like VS does.

@jonathanpeppers
Copy link
Copy Markdown
Member Author

Could a project set <MetadataUpdaterSupport>false</MetadataUpdaterSupport> as well?

What made me look at this, is this issue:

It made me wonder if hot reload works for a $(Configuration) named something like DebugProd or Prod.

@tmat
Copy link
Copy Markdown
Member

tmat commented May 12, 2026

Yes, MetadataUpdaterSupport can be set by project.

I think what we need to do is:
If TFV >= 11 then check MetadataUpdaterSupport, otherwise check DebugSymbols == true && Optimize == false.

VS currently does the latter. I'll change it to check the same condition as watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants