Skip to content

fix(hotreload): do not fork the solution for an add that changed nothing (backport #24617) - #25773

Merged
agneszitte merged 3 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-24617
Oct 28, 2026
Merged

agneszitte merged 3 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-24617

Conversation

@mergify

@mergify mergify Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Closes #24616
Closes https://github.com/unoplatform/uno.hotdesign/issues/8040

SolutionUpdater now tracks whether an add or a remove was applied, gates the analyzer-config
refresh on that, and compares config content before rewriting — the same content-level rule spec 055
R1 already applied to document texts.

Tests

  • Given_SolutionUpdater.When_AddedDocumentIsAlreadyInProject_Then_OriginalSolutionInstanceReturned
    fails without the fix (the solution is forked) and passes with it.
  • IRL_Case_002 records the field sequence in MetadataUpdateTests: edit, empty generation,
    edit -> NullReferenceException in DefinitionMap.GetPreviousPropertyHandle. Marked
    IsCrashingRoslyn, like the existing When_Page_Res_xBind_Remove, so it reports
    Inconclusive until HR fails when requesting an intermediate empty update dotnet/roslyn#79898 is fixed.
  • Uno.HotReload.Tests: 147/147.

Not addressed

The unrealized-text bypass of spec 055 R1 stays as-is: comparing an unrealized document would
re-read the file and could swallow a first edit. Closing it requires remembering what the current
compilation saw, which is a design change of its own.


This is an automatic backport of pull request #24617 done by Mergify.

A pass that mutates nothing must return the original solution instance, so the
manager takes its NoChanges short-circuit before reaching the EnC emit. Two
paths defeated that: the analyzer-config refresh rewrote every .editorconfig as
soon as the change set *requested* an add or a remove — including an add the
updater de-duplicates because the document is already in the project, which is
what a re-observed file creation looks like — and the removes were applied even
for an empty list. Both fork the snapshot, and a forked snapshot is emitted.

The refresh now runs only when an add or a remove was actually applied, and
compares content before rewriting, as the document texts already did.

The cost is not a wasted roundtrip. An update Roslyn resolves to `status: None`
corrupts the edit session's deleted-member bookkeeping, and the failure lands on
the *next* real edit as a NullReferenceException in
DefinitionMap.GetPreviousPropertyHandle (dotnet/roslyn#79898), leaving hot
reload dead for the rest of the session. IRL_Case_002 records that sequence in
the metadata-update scenarios: edit, empty generation, edit.

(cherry picked from commit 8a21757)
The gate moved from what the change set requested to what the updater actually
applied, and only the negative side was covered: a de-duplicated add must not
fork the solution. Nothing pinned the positive side, so a regression leaving the
flag false for a genuine add would silently stop refreshing analyzer configs —
the behaviour the gate exists to preserve.

Verified to bite: with the flag assignment removed from the add loop, the new
test fails on the config text still reading "is_global = true" instead of the
on-disk content.

(cherry picked from commit 4dabbe1)
… test

This repo is public; the field report it cited lives in a private tracker, and
AGENTS.md forbids a public spec from carrying a private issue identifier as
normative evidence. The observation that matters — the empty update sitting one
second before the crashing emit — is kept, without the reference.

The test plan also stopped at the de-duplicated add while the same branch added
the genuine-add test, so the spec was undercounting its own coverage.

(cherry picked from commit 6dc6199)
@github-actions github-actions Bot added area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation labels Oct 28, 2026
@agneszitte
agneszitte merged commit 15777b4 into servicing/6.8 Oct 28, 2026
7 of 14 checks passed
@agneszitte
agneszitte deleted the mergify/bp/servicing/6.8/pr-24617 branch October 28, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants