Repository navigation
Warn when MetadataUpdaterSupport is false in dotnet watch - #54264
jonathanpeppers merged 1 commit into
Conversation
46550c8 to
e990aac
Compare
|
Note that when |
There was a problem hiding this comment.
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.
|
Could a project set What made me look at this, is this issue: It made me wonder if hot reload works for a |
|
Yes, MetadataUpdaterSupport can be set by project. I think what we need to do is: VS currently does the latter. I'll change it to check the same condition as watch. |
e990aac to
5d781ca
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
src/Dotnet.Watch/Watch/AppModels/HotReloadAppModel.cs:110
GetBooleanPropertyValue(PropertyNames.DebugSymbols)is invoked without an explicitdefaultValue, so it falls back tofalse(see ProjectGraphUtilities.cs:87-88). If theDebugSymbolsproperty is not evaluated/set on the ProjectInstance for any reason, this will incorrectly emit the "project does not support Hot Reload" warning and abort. Consider passing an explicitdefaultValueconsistent with MSBuild defaults (and document the assumption), as is done a few lines above forMetadataUpdaterSupportandStartupHookSupport.
if (!project.ProjectInstance.GetBooleanPropertyValue(PropertyNames.DebugSymbols))
{
logger.Log(MessageDescriptor.ProjectDoesNotSupportHotReload_Property, PropertyNames.DebugSymbols, "False", PropertyNames.DebugSymbols, "True");
return false;
}
test/dotnet-watch.Tests/HotReload/SourceFileUpdateTests.HotReloadNotSupported.cs:15
- The test method name
ChangeFileInAotProjectand the parameter namepropertyNamemade sense when the inputs were AOT/trimming-related. Now that the theory also coversOptimize=True(and ideallyMetadataUpdaterSupport=False/DebugSymbols=False), the method name is misleading. Consider renaming to something likeChangeFileInProjectThatDoesNotSupportHotReload.
public async Task ChangeFileInAotProject(string propertyName, string propertyValue)
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 <[email protected]>
5d781ca to
3b9b343
Compare
|
Merging, the failure looks unrelated: Build Analysis check is also green. |
Warn when project configuration disables Hot Reload in
dotnet watch, matching the checks that VS uses in dotnet-project-system PR 738329.Background
Previously,
dotnet watchonly checkedStartupHookSupport(andPublishAot/PublishTrimmedwhich imply it). It did not warn when the runtime'sMetadataUpdater.IsSupportedwould befalse, leading to confusing behavior — e.g. runningdotnet watchin a non-Debug configuration would silently fail to apply Hot Reload updates.Changes
TFM >= .NET 11 — check
MetadataUpdaterSupport. This property is now correctly set by the runtime starting in .NET 11.TFM < .NET 11 — check
Optimize == falseandDebugSymbols == true, sinceMetadataUpdaterSupportwas not reliably set for older frameworks. This matches what VS does.Files changed
Versions.cs— AddedVersion11_0constantBuildNames.cs— AddedMetadataUpdaterSupport,Optimize,DebugSymbolsconstantsHotReloadAppModel.cs— Added TFM-gated checks with link to runtime PRSourceFileUpdateTests.HotReloadNotSupported.cs— ReplacedMetadataUpdaterSupport=Falsetest case withOptimize=True(test TFM isnet10.0, so the< 11path is exercised)