Turn XAML Incremental Hot Reload (XIHR) off by default - #36832
Conversation
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
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36832Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36832" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
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.targetsto defaultEnableMauiIncrementalHotReloadtofalsewhen unset, removing the Debug-only implicit enablement. - Kept legacy hot reload as the default fallback (
MauiXamlHotReloaddefaults toLegacyunless XIHR is explicitly enabled). - Updated the
MSBuildTests.cscomment 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. |
|
The samples builds seem to be failing We will also need to backport to net11 preview7 branch |
|
/backport to release/11.0.1xx-preview7 |
|
Started backporting to |
…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
This reverts commit 5fdf3fa.
<!-- 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>
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:EnableMauiIncrementalHotReloadnow defaults tofalseunless the developer explicitly sets it totrue. Removed theConfiguration == 'Debug'branch that defaulted it totrue.MauiXamlHotReloadstaysLegacywhen XIHR is off).MSBuildTests.csthat described XIHR as "on by default in Debug".Notes
IsIncrementalHotReloadEnabledByDefault) is alreadyfalse, so this change makes the MSBuild default coherent with the runtime default end-to-end.<EnableMauiIncrementalHotReload>true</EnableMauiIncrementalHotReload>in the project.