Skip to content

Turn XAML Incremental Hot Reload (XIHR) off by default - #36832

Merged
kubaflo merged 1 commit into
net11.0from
fix/xihr-off-by-default
Jul 28, 2026
Merged

Turn XAML Incremental Hot Reload (XIHR) off by default#36832
kubaflo merged 1 commit into
net11.0from
fix/xihr-off-by-default

Conversation

@StephaneDelcroix

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

XAML Incremental Hot Reload (XIHR) was enabled by default for Debug builds on the net11.0 branch, which is causing issues. This PR makes XIHR opt-in instead of on-by-default.

Changes

  • Microsoft.Maui.Controls.targets: EnableMauiIncrementalHotReload now defaults to false unless the developer explicitly sets it to true. Removed the Configuration == 'Debug' branch that defaulted it to true.
  • Legacy XAML Hot Reload remains the default fallback (MauiXamlHotReload stays Legacy when XIHR is off).
  • Updated a stale comment in MSBuildTests.cs that described XIHR as "on by default in Debug".

Notes

  • The runtime feature switch default (IsIncrementalHotReloadEnabledByDefault) is already false, so this change makes the MSBuild default coherent with the runtime default end-to-end.
  • To opt back in, set <EnableMauiIncrementalHotReload>true</EnableMauiIncrementalHotReload> in the project.
  • Existing XIHR unit tests set the flag explicitly and are unaffected.

XIHR was enabled by default for Debug builds, which caused issues.
Make it opt-in instead: EnableMauiIncrementalHotReload now defaults to
false unless the developer explicitly sets it to true. Legacy XAML Hot
Reload remains the default fallback.

The runtime feature switch (IsIncrementalHotReloadEnabledByDefault) is
already false, so this makes the MSBuild default coherent with the
runtime default end-to-end.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 78048f76-1e94-4d6a-b306-7d8c74ddea9f
Copilot AI review requested due to automatic review settings July 27, 2026 14:44
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36832

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36832"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes XAML Incremental Hot Reload (XIHR) opt-in by default by changing the MAUI Controls transitive targets to default EnableMauiIncrementalHotReload to false (instead of implicitly enabling it in Debug). This aligns the MSBuild-side default with the runtime feature switch default and preserves legacy XAML Hot Reload as the default fallback behavior.

Changes:

  • Updated Microsoft.Maui.Controls.targets to default EnableMauiIncrementalHotReload to false when unset, removing the Debug-only implicit enablement.
  • Kept legacy hot reload as the default fallback (MauiXamlHotReload defaults to Legacy unless XIHR is explicitly enabled).
  • Updated the MSBuildTests.cs comment to reflect XIHR being off by default and explicitly pinned off in the test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs Updates a test comment to match the new XIHR default (opt-in) while continuing to pin XIHR off for the legacy fallback scenario.
src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets Changes the default EnableMauiIncrementalHotReload behavior to false when unset and updates the explanatory comment; preserves MauiXamlHotReload default fallback to Legacy.

@github-actions github-actions Bot added the area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging label Jul 27, 2026
@rmarinho

rmarinho commented Jul 28, 2026

Copy link
Copy Markdown
Member

The samples builds seem to be failing

We will also need to backport to net11 preview7 branch

@kubaflo
kubaflo merged commit 5fdf3fa into net11.0 Jul 28, 2026
33 of 39 checks passed
@kubaflo
kubaflo deleted the fix/xihr-off-by-default branch July 28, 2026 14:30
@github-actions github-actions Bot added this to the .NET 11.0-preview7 milestone Jul 28, 2026
@kubaflo

kubaflo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

/backport to release/11.0.1xx-preview7

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx-preview7 (link to workflow run)

kubaflo pushed a commit that referenced this pull request Jul 28, 2026
…ff by default (#36881)

> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Backport of #36832 to release/11.0.1xx-preview7

### Description

XAML Incremental Hot Reload (XIHR) was enabled **by default for Debug
builds**, which is causing issues. This PR makes XIHR **opt-in** instead
of on-by-default.

### Changes

- `Microsoft.Maui.Controls.targets`: `EnableMauiIncrementalHotReload`
now defaults to `false` unless the developer explicitly sets it to
`true`. Removed the `Configuration == 'Debug'` branch that defaulted it
to `true`.
- Legacy XAML Hot Reload remains the default fallback
(`MauiXamlHotReload` stays `Legacy` when XIHR is off).
- Updated a stale comment in `MSBuildTests.cs` that described XIHR as
"on by default in Debug".

### Notes

- The runtime feature switch default
(`IsIncrementalHotReloadEnabledByDefault`) is already `false`, so this
change makes the MSBuild default coherent with the runtime default
end-to-end.
- To opt back in, set
`<EnableMauiIncrementalHotReload>true</EnableMauiIncrementalHotReload>`
in the project.
- Existing XIHR unit tests set the flag explicitly and are unaffected.

/cc @kubaflo @StephaneDelcroix

Co-authored-by: Stephane Delcroix <stephane@delcroix.org>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 78048f76-1e94-4d6a-b306-7d8c74ddea9f
kubaflo pushed a commit that referenced this pull request Aug 6, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description

Re-enables XAML Incremental Hot Reload (XIHR) by default for Debug
builds on `net11.0`. This undoes the temporary opt-out from #36832 now
that the deterministic generation and Edit-and-Continue stability fixes
from #36833 are merged.

### Behavior

| Configuration | `EnableMauiIncrementalHotReload` | `MauiXamlHotReload`
|
|---|---|---|
| Debug (default) | `true` | `SourceGen` |
| Release / publish (default) | `false` | `Legacy` |
| Debug + explicit `false` | `false` | `Legacy` |
| Release + explicit `true` | `true` | `SourceGen` |

The legacy fallback test remains explicitly pinned to XIHR-off and its
comment now reflects the restored Debug default.

### Testing

- Evaluated the MSBuild property cascade for the four configurations
above.
- `MSBuildTests.BuildAProject`
- `MSBuildTests.HotReloadSupportForXSG` (Debug and Release)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants