[Hot Reload] Do not attempt to apply empty deltas. #63979
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Do not call the runtime to apply empty deltas. The change applies the same condition we use in 10.0 to 9.0.
Description
The 9.0 runtime does not ignore empty deltas -- the change to ignore them was only implemented in .NET 10: dotnet/runtime#120333.
When debugging WASM app with the new WASM ICoreDebug-based debugger, the debugger applies deltas and the agent is sent empty deltas. The expectation is that the deltas are ignored and the only action that the agent performs is invoking metadata update handlers.
If the deltas are not skipped in this scenario the 9.0 runtime throws an exception:
"Applying deltas through the debugger and System.Reflection.Metadata.MetadataUpdater.ApplyUpdate simultaneously is not supported"
If we didn't call the agent at all the deltas would be correctly applied by the new WASM debugger but the metadata update handlers wouldn't be executed and thus the app wouldn't function properly (caches not invalidated, UI not refreshed).
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2571149
Customer Impact
Hot Reload is broken for customers debugging WASM projects from Visual Studio 2026 using the new ICorDebug-based WASM debugger and projects targeting net9.0.
Regression?
Partial regression: Previous versions of VS did not fail to apply change entirely, but also did not invoke update handlers, which leaves the app in partially-updated state.
Fixing that in VS caused regression in net90 projects because they lack the condition added in this change.
Risk
The condition is trivial and well tested in net10.
Verification
Packaging changes reviewed?
When servicing release/2.3