From c0d7b2cfe92dd17578a381e890baa6308363c60d Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Mon, 27 Jul 2026 16:44:00 +0200 Subject: [PATCH] Turn XAML Incremental Hot Reload (XIHR) off by default 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 --- .../netstandard2.0/Microsoft.Maui.Controls.targets | 12 +++++------- .../tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets b/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets index d3766c044a71..0083977834db 100644 --- a/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets +++ b/src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets @@ -10,13 +10,11 @@ <_MauiXamlInflator Condition="' $(MauiXamlInflator)' != '' ">$(MauiXamlInflator) <_MauiXamlInflator Condition=" '$(MauiXamlInflator)' == '' ">SourceGen - - true + false diff --git a/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs b/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs index 472f3dce1a04..fa82c0d92690 100644 --- a/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs +++ b/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs @@ -310,7 +310,7 @@ public void HotReloadSupportForXSG(string configuration) project.Save(projectFile); // Pin XIHR off: this test covers the legacy ResourceProvider2 hot-reload fallback // (InitializeComponentRuntime), which XAML Incremental Hot Reload intentionally supersedes - // when enabled (on by default in Debug). See dotnet/maui#36682. + // when enabled. XIHR is off by default (opt-in), but pin it explicitly here. See dotnet/maui#36682. Build(projectFile, additionalArgs: $"-c {configuration} -p:MauiXamlInflator=SourceGen -p:EnableMauiIncrementalHotReload=false -p:EmitCompilerGeneratedFiles=True -p:CompilerGeneratedFilesOutputPath=Generated"); var generatorDirectory = IOPath.Combine(tempDirectory, "Generated", "Microsoft.Maui.Controls.SourceGen", "Microsoft.Maui.Controls.SourceGen.XamlGenerator");