Skip to content

Fix Windows debugging failure with .NET 10 SR13 - #39830

Merged
kubaflo merged 4 commits into
dotnet:release/10.0.1xx-sr13from
devanathan-vaithiyanathan:fix-39801
Nov 2, 2026
Merged

kubaflo merged 4 commits into
dotnet:release/10.0.1xx-sr13from
devanathan-vaithiyanathan:fix-39801

Conversation

@devanathan-vaithiyanathan

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!

Issue Details:

Windows applications using the SR13 build crash during Shell initialization.

Root Cause:

The Shell appearance update first populated and refreshed WinUI’s disabled-foreground resources through the existing text-color methods. The newly added UpdateTopNavigationViewItemDisabledColor() then overwrote those same resource entries. The observed COMException occurred during this second resource-dictionary update.

Description of changes

  • Apply the effective disabled color directly in the existing selected and unselected text-color resource updates, avoiding the separate overwrite after theme-resource refresh.
  • Preserve the existing public text-color methods through internal overloads accepting the disabled paint.
  • Keep UpdateTopNavigationViewItemDisabledColor() responsible only for propagating the disabled brush to tab view models and nested items.
  • Preserve disabled icon coloring and restore fallback text colors or native resources when TabBarDisabledColor is cleared.

Issues Fixed

Fixes #39801

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac
Before After
Windows
Windows

@github-actions

github-actions Bot commented Nov 2, 2026

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 -- 39830

Or

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

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Nov 2, 2026
@azure-pipelines

This comment has been minimized.

@devanathan-vaithiyanathan devanathan-vaithiyanathan added the community ✨ Community Contribution label Nov 2, 2026
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title [WIP] Fix Windows debugging failure with .NET 10 SR13 Fix Windows debugging failure with .NET 10 SR13 Nov 2, 2026
@devanathan-vaithiyanathan
devanathan-vaithiyanathan marked this pull request as ready for review November 2, 2026 13:51
Copilot AI balanced review requested due to automatic review settings November 2, 2026 13:51
@sheiksyedm sheiksyedm linked an issue Nov 2, 2026 that may be closed by this pull request
@sheiksyedm

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

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.

🔵 Needs a closer look

Native Windows Debug/Release and theme-transition testing is needed to confirm the Shell startup resource-ordering change resolves the COMException and preserves theme updates, which source-only review could not verify.

No open issues 🎉

What changed in this PR

Addresses the Windows Shell initialization crash reported in #39801 for .NET 10 SR13 by avoiding a second overwrite of disabled-foreground resources after WinUI refreshes them.

Changes:

  • Apply disabled text colors within existing resource updates, preserving public method signatures and fallback behavior.
  • Pass the disabled color from the Shell handler while retaining separate propagation to item view models.
  • Add Windows device tests covering applying, changing, and clearing the disabled color, with and without explicit text colors.
File Description
src/​Core/​src/​Platform/​Windows/​NavigationViewExtensions.cs Consolidates disabled-foreground resource updates through internal overloads.
src/​Controls/​tests/​DeviceTests/​Elements/​Shell/​ShellTabBarTests.Windows.cs Tests disabled-color changes and restoration of original brushes.
src/​Controls/​src/​Core/​Handlers/​Shell/​ShellItemHandler.Windows.cs Supplies disabled colors to selected and unselected text-color updates.

Review effort: Balanced

@kubaflo
kubaflo merged commit 94fa72b into dotnet:release/10.0.1xx-sr13 Nov 2, 2026
13 of 60 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR13 milestone Nov 2, 2026
kubaflo added a commit that referenced this pull request Nov 2, 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Port the exact Windows fix and regression coverage from #39830, merged
into `release/10.0.1xx-sr13` as
`94fa72b3d91a979ec02fa335c1e37a70e7eb837e`, onto `main`.

Shell appearance updates refreshed WinUI's disabled-foreground resources
through the existing text-color methods, then overwrote the same entries
in `UpdateTopNavigationViewItemDisabledColor()`. The second
resource-dictionary update caused the Shell initialization crash
reported in #39801.

The port:
- Applies effective disabled paint during the existing
selected/unselected text-color resource updates, without the later
overwrite.
- Preserves both public text-color methods through internal overloads;
the separate disabled-color method still updates tab view models and
nested items, preserving disabled icons and fallback behavior.
- Preserves the two-case Windows regression theory that applies,
changes, and clears `TabBarDisabledColor`, both with and without
explicit text colors.

No conflict-resolution changes or new public APIs. The three-file diff
is patch-equivalent to #39830: stable patch ID
`3f29f44e43be2732794b22470e4def1cb8205697` (98 additions, 17 deletions).
Fresh main ancestry, patch-equivalence checks, and searches of
open/recently merged PRs found no existing main equivalent.

#### Validation

**Passed:**

```sh
dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs src/Core/src/Platform/Windows/NavigationViewExtensions.cs src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs --verbosity quiet

dotnet format whitespace --folder --include src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs src/Core/src/Platform/Windows/NavigationViewExtensions.cs src/Controls/tests/DeviceTests/Elements/Shell/ShellTabBarTests.Windows.cs --verify-no-changes --verbosity quiet

git diff --cached --check
```

Roslyn syntax parsing with the `WINDOWS` preprocessor symbol also passed
for all three changed files. These are static checks, not a Windows
build or runtime result.

**Blocked on this macOS host:**

```sh
pwsh -NoProfile .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform windows -TestFilter 'Category=Shell' -IncludeClasses Microsoft.Maui.DeviceTests.ShellTests -IncludeMethods TabBarDisabledColorCanBeAppliedChangedAndCleared
```

The runner exits before building: `Platform 'windows' is not supported
on this OS`.

```sh
dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net11.0-windows10.0.19041.0 --no-restore -p:EnableWindowsTargeting=true -p:IncludeWindowsTargetFrameworks=true -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false --nologo -v:quiet

dotnet build Microsoft.Maui.BuildTasks.slnf --nologo -v:quiet
```

The cross-build stops at missing MAUI MSBuild tasks. Building those
prerequisites fails with `NETSDK1140`: installed Apple workloads support
26.5, while main requires 27.0 (the installed SDK is an older .NET 11
preview). No successful compile or Windows test result is claimed.
Source PR #39830 records Windows manual testing; this main-targeted port
still requires Windows CI/runtime validation.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39801
Ports #39830 to main.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo added a commit that referenced this pull request Nov 13, 2026
…on backports (#40217)

<!-- 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!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

**Explicit release-target exception:** this PR intentionally targets the
new `release/10.0.1xx-sr14` branch. `main`, `net11` and the inflight
lanes are now .NET 11, so .NET 10 SR14 is cut from the SR13 release head
(`release/10.0.1xx-sr14` was created at `54d76458e0`, the tip of
`release/10.0.1xx-sr13`, which already includes all post-cut SR13 fixes
#39830, #39855, #39879, #39891 and the servicing/stable configuration
from #39774).

This PR brings the .NET 10 changes needed since SR13:

1. **Backport #39887** – `[Windows] Prevent duplicate Shell startup
navigation from stale tab selection events`. Fixes #39859 (regressed in
10.0.120); it was merged only to `main`. Clean `cherry-pick -x`.
2. **Backport #40132** – `Fix custom Shape.PathForBounds dispatch
regression`. Fixes #40129 (regressed in 10.0.130); it was merged only to
`candidate/11.0.1xx-sr2`. The unrelated .NET 11
`eng/release-rollover.json` change from that commit is excluded (file
does not exist on the .NET 10 line).
3. **Version bump** – `PatchVersion` 130 → 140 in `eng/Versions.props`.
Servicing label and `StabilizePackageVersion=true` are inherited from
SR13.

Reviewed and intentionally **not** included:

- #40136 (`net10.0` Publish-Build-Assets cleanup): SR13 has no
`Publish-Build-Assets` references, so nothing to remove.
- #39882 (re-land of the CollectionView2 height fix): SR13 already
carries the revert #39855 that fixed #39847; re-landing is a
fix-forward, not a regression fix.
- #40213 (`[net10.0][XSG]` CA2252 suppression, issue #40045): still
open/unmerged; can be backported once approved.
- Other `regressed-in-10.0.1x0` issues closed since the SR13 cut
(#38622, #39557/#39681, #39722) are already fixed on SR13 or were fixed
outside MAUI.

Keep in draft pending review and CI. This PR does not tag, publish, or
authorize a release; the internal dnceng mirror of
`release/10.0.1xx-sr14` has not been created.

#### Validation

Using the pinned SDK `10.0.113` provisioned by `eng/common/dotnet.sh`:

- `dotnet msbuild eng/Versions.props
-getProperty:PatchVersion,SdkBandVersion,PreReleaseVersionLabel,StabilizePackageVersion,DotNetFinalVersionKind`
→ `140`, `10.0.100`, `servicing`, `true`, `release`. `xmllint --noout
eng/Versions.props` passed.
- `dotnet test
src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj -f
net10.0 --filter FullyQualifiedName~StrokeShapeTests` (platform TFMs
disabled): **passed 59/59**. With `Shape.cs` reverted to SR13: **failed
3/59** (the new `CustomShapeReimplementingIShape*` tests); restored:
**passed 59/59**.
- #39887 is Windows-only (`ShellItemHandler.Windows.cs` + Windows device
test) and was not built locally on macOS; it relies on CI.

### Issues Fixed

Fixes #39859
Fixes #40129

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

---------

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — be91380c Deployed Nov 2, 2026 by devanathan-vaithiyanathan via conclusion #2638
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MAUI][.NET10] Debugging on windows fails using SR13

4 participants