[HotReload] Surface XAML Incremental Hot Reload diagnostics for IDE tooling - #36459
Merged
StephaneDelcroix merged 1 commit intoJul 9, 2026
Conversation
Extends HotReloadDiagnostics so IDE tooling (VS / VS Code MAUI Hot Reload) can classify and report XIHR cycles: - HotReloadDiagnostics: add UpdateSkipped terminal event (recognized batch with no live instances to patch). - HotReloadRequestedEventArgs.HandledTypes: the recognized incremental-XAML subset, raised synchronously before dispatch so tooling can classify the update type inline. - HotReloadErrorEventArgs.Version: correlates a per-instance failure with its apply's ToVersion. - XamlIncrementalHotReloadHandler: raise OnUpdateRequested (sync, pre-dispatch) with handled types; OnUpdateSkipped for an empty batch; pass toVersion to OnUpdateFailed; allocate the version only for non-empty batches (gap-free version stream). - Document the reflection-by-name contract XamlTools relies on. - Add XamlIncrementalHotReloadHandlerTests (7 tests).
noiseonwires
had a problem deploying
to
copilot-pat-pool
July 8, 2026 18:50 — with
GitHub Actions
Failure
Contributor
|
Hey there @@noiseonwires! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
|
Hey there @noiseonwires! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Member
Author
|
@StephaneDelcroix that's the implementation of #36078 (comment) proposal |
This was referenced Jul 9, 2026
StephaneDelcroix
merged commit Jul 9, 2026
7680d96
into
dotnet:feature/xaml-incremental-hotreload
8 of 10 checks passed
StephaneDelcroix
pushed a commit
that referenced
this pull request
Jul 20, 2026
…ooling (#36459) ### Description Incremental contribution to `feature/xaml-incremental-hotreload`. Extends `HotReloadDiagnostics` so IDE tooling (the Visual Studio / VS Code MAUI Hot Reload diagnostics, a.k.a. "XamlTools") can **classify** a hot reload cycle as XAML Incremental Hot Reload (XIHR), **report** its apply stats, and **surface** per-instance failures. Today the tooling only sees a generic managed-code delta, so it misclassifies XAML SourceGen edits as plain C# and can't report the incremental apply result. All changes are **purely additive** to the diagnostics surface — no change to the hot reload apply itself, and no breaking API changes. #### New / changed public API (`Microsoft.Maui.Controls.Xaml.Diagnostics`) - **`HotReloadDiagnostics.UpdateSkipped`** — new event. Terminal signal raised when an update is *recognized* (has generated `UpdateComponent()` types) but nothing is dispatched because there are no live instances to patch, so observers always get a definite outcome even when `UpdateApplied` never fires. - **`HotReloadRequestedEventArgs.HandledTypes`** — the recognized incremental-XAML subset of `UpdatedTypes`. Raised **synchronously, before any UI-thread dispatch**, so tooling can classify the update type inline (XIHR vs. non-XAML) without awaiting the async apply. - **`HotReloadErrorEventArgs.Version`** — the update-cycle version a per-instance failure belongs to (matches the corresponding `HotReloadAppliedEventArgs.ToVersion`), so failures can be correlated with their apply. - **`HotReloadSkippedEventArgs`** — new event args for `UpdateSkipped` (`UpdatedTypes`, `HandledTypes`, `Timestamp`). #### Handler (`XamlIncrementalHotReloadHandler`) - Builds the `handledTypes` set and raises `OnUpdateRequested` synchronously before dispatch. - Raises `OnUpdateSkipped` for a recognized-but-empty batch (returns without dispatch). - Passes `toVersion` to `OnUpdateFailed`. - Allocates the diagnostic version only for **non-empty** batches, keeping the version stream gap-free (every increment is paired with an `UpdateApplied`). #### Firing contract (documented in-code) The three files carry brief "XamlTools contract" comments describing the reflection-by- name binding surface tooling relies on: the type/event/property names, the `EventHandler<T>` shapes, and the ordering guarantees — `UpdateRequested` is synchronous and pre-dispatch; a dispatched batch ends with exactly one terminal `UpdateApplied` (always raised, even if every instance failed) or `UpdateSkipped`; each `UpdateFailed` precedes its batch's `UpdateApplied`. ### Issues Fixed Fixes # <!-- link the XIHR-diagnostics tracking issue, if any --> ### Testing - Added `XamlIncrementalHotReloadHandlerTests` (7 tests, `Controls/tests/Core.UnitTests`) covering: `UpdateRequested`/`HandledTypes` classification, `UpdateApplied` instance/version/duration, `UpdateFailed` per-instance + `Version` correlation, and the `UpdateSkipped` no-live-instances path. Uses a `MainThread` custom-implementation harness for the UI-thread dispatch. - Verified end-to-end on a physical Android device with the consuming IDE tooling: a XAML SourceGen edit is classified as `xaml-sourcegen` and the IDE reports the incremental apply (instance count, `version 0→1`, duration). ### API Changes Additive only — see the updated `PublicAPI.Unshipped.txt` for all TFMs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
Incremental contribution to
feature/xaml-incremental-hotreload.Extends
HotReloadDiagnosticsso IDE tooling (the Visual Studio / VS Code MAUIHot Reload diagnostics, a.k.a. "XamlTools") can classify a hot reload cycle as
XAML Incremental Hot Reload (XIHR), report its apply stats, and surface
per-instance failures. Today the tooling only sees a generic managed-code delta, so
it misclassifies XAML SourceGen edits as plain C# and can't report the incremental
apply result.
All changes are purely additive to the diagnostics surface — no change to the
hot reload apply itself, and no breaking API changes.
New / changed public API (
Microsoft.Maui.Controls.Xaml.Diagnostics)HotReloadDiagnostics.UpdateSkipped— new event. Terminal signal raised when anupdate is recognized (has generated
UpdateComponent()types) but nothing isdispatched because there are no live instances to patch, so observers always get a
definite outcome even when
UpdateAppliednever fires.HotReloadRequestedEventArgs.HandledTypes— the recognized incremental-XAMLsubset of
UpdatedTypes. Raised synchronously, before any UI-thread dispatch, sotooling can classify the update type inline (XIHR vs. non-XAML) without awaiting the
async apply.
HotReloadErrorEventArgs.Version— the update-cycle version a per-instancefailure belongs to (matches the corresponding
HotReloadAppliedEventArgs.ToVersion),so failures can be correlated with their apply.
HotReloadSkippedEventArgs— new event args forUpdateSkipped(UpdatedTypes,HandledTypes,Timestamp).Handler (
XamlIncrementalHotReloadHandler)handledTypesset and raisesOnUpdateRequestedsynchronously beforedispatch.
OnUpdateSkippedfor a recognized-but-empty batch (returns without dispatch).toVersiontoOnUpdateFailed.stream gap-free (every increment is paired with an
UpdateApplied).Firing contract (documented in-code)
The three files carry brief "XamlTools contract" comments describing the reflection-by-
name binding surface tooling relies on: the type/event/property names, the
EventHandler<T>shapes, and the ordering guarantees —UpdateRequestedis synchronousand pre-dispatch; a dispatched batch ends with exactly one terminal
UpdateApplied(always raised, even if every instance failed) or
UpdateSkipped; eachUpdateFailedprecedes its batch's
UpdateApplied.Issues Fixed
Fixes #
Testing
XamlIncrementalHotReloadHandlerTests(7 tests,Controls/tests/Core.UnitTests)covering:
UpdateRequested/HandledTypesclassification,UpdateAppliedinstance/version/duration,
UpdateFailedper-instance +Versioncorrelation, and theUpdateSkippedno-live-instances path. Uses aMainThreadcustom-implementationharness for the UI-thread dispatch.
a XAML SourceGen edit is classified as
xaml-sourcegenand the IDE reports theincremental apply (instance count,
version 0→1, duration).API Changes
Additive only — see the updated
PublicAPI.Unshipped.txtfor all TFMs.