Repository navigation
Description
What would you like to be added? 💡
A decision, and then the matching behavior, for what hot reload does when a .cs file that defines a type is deleted during a session.
On the Roslyn 5.6 line embedded by the DevServer, deleting such a file is a rude edit:
error ENC0033: Deleting class 'Test01.Simple' requires restarting the application.
Two options:
- Record it. Deleting a type is a rude edit, as Roslyn says. Update the scenario expectations to
ENC0033and leave the behavior as is. - Don't treat a file removal as a rude edit. For example, keep the deleted type in the compilation the DevServer emits against, since the running app can't unload it anyway, so edits to the rest of the project keep applying. That makes the DevServer's view differ from the sources on disk until the next build, which needs its own decision.
Why is this needed? 🤔
Since #24085 (the fix for #25378), a rude edit is never committed to the Edit-and-Continue baseline. That fix is correct, but it changes what a file deletion costs. The deletion stays pending, so every later edit to that project is reported as a rude edit until the app is restarted, including unrelated edits in other files. Deleting an unused class while hot reloading is common, so this is a likely way to fall into "hot reload stopped working".
Before #24085 the deletion was committed anyway. That silently diverged the session (the #25378 symptoms), so going back to it isn't an option.
Two hot-reload scenarios cover this and are marked Ignore until it's decided:
When_Style_MarkupExtension_Remove_Inc_ExtWhen_Style_MarkupExtension_Add_Remove_Inc_Ext
(under src/SourceGenerators/Uno.UI.SourceGenerators.Tests/MetadataUpdateTests/Scenarios/). In their second pass, a ResourceDictionary stops using a markup extension and SimpleMarkupExtension.cs (class Test01.Simple) is deleted. Their expectations, recorded on Roslyn 4.x, declare 1 metadata update and no diagnostic. On 5.6, with the Ignore removed, all four runs (CoreCLR and Mono) fail only on that ENC0033.
For which platforms 📱💻🖥️
All platforms 🌍
Anything else we need to know? 💬
- The DevServer reports the
ENC0033correctly. Edit-and-Continue can delete members, but not types. - Option 2 would live in the DevServer's solution update (
Uno.HotReload), not in Roslyn. - Once this is decided, remove the
Ignoreentries from the twoScenario.jsonfiles, which currently point here.
Activity
test(hr): point the ENC0033 scenario ignores at #25500
test(hr): re-enable base-type HR scenarios