Skip to content

[HotReload] Decide how deleting a type's .cs file is handled on Roslyn 5.x (ENC0033) #25500

Open

Description

@kazo0

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:

  1. Record it. Deleting a type is a rude edit, as Roslyn says. Update the scenario expectations to ENC0033 and leave the behavior as is.
  2. 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_Ext
  • When_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 ENC0033 correctly. 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 Ignore entries from the two Scenario.json files, which currently point here.

Activity

  1. added
    kind/enhancement
    triage/untriaged
    area/hot-reload
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/hot-reloadkind/enhancementtriage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions