Repository navigation
Conversation
Defer custom font rendering beyond the current XAML layout tick while preserving UI-thread Win2D rendering. Honor cancellation before rendering and after yielding, and dispose CanvasTextFormat. Add Windows device tests for deferred rendering, glyph output, cancellation, and custom font rendering during layout alongside bitmap decoding. Fixes dotnet#39888
sheiksyedm
temporarily deployed
to
copilot-pat-pool
November 5, 2026 08:22 — with
GitHub Actions
Inactive
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39911Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39911" |
sheiksyedm
temporarily deployed
to
copilot-pat-pool
November 5, 2026 08:22 — with
GitHub Actions
Inactive
This comment has been minimized.
This comment has been minimized.
sheiksyedm
temporarily deployed
to
copilot-pat-pool
November 5, 2026 08:23 — with
GitHub Actions
Inactive
sheiksyedm
temporarily deployed
to
copilot-pat-pool
November 5, 2026 08:25 — with
GitHub Actions
Inactive
sheiksyedm
temporarily deployed
to
copilot-pat-pool
November 5, 2026 08:26 — with
GitHub Actions
Inactive
sheiksyedm
temporarily deployed
to
copilot-pat-pool
November 5, 2026 08:27 — with
GitHub Actions
Inactive
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Ignore and dispose image results when the thumb source changed while loading, and prevent obsolete bitmap callbacks from resizing the current thumb. Add attached Slider font-to-null and font-to-bitmap regression cases. Notify the handler when updating the size-test stub source.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Deferred font rendering can let stale results overwrite newer or cleared icons, so affected consumers need request-version or cancellation guards and regression tests for these transitions.
1 open issue
What changed in this PR
Addresses #39888 by deferring Windows font-image rendering to avoid dispatcher reentrancy during XAML layout while bitmap images decode.
Changes:
- Defers rendering with
Task.Yield(), honors cancellation, and disposesCanvasTextFormat. - Prevents outdated slider thumb-image requests from applying after the source changes.
- Adds Windows device tests for rendering, cancellation, layout stress, and slider source replacement.
| File | Description |
|---|---|
src/Core/tests/DeviceTests/Services/ImageSource/FontImageSourceServiceTests.Windows.cs |
Adds rendering, cancellation, and layout/bitmap-decoding regression tests. |
src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs |
Tests pending font-image replacement and explicitly updates the existing test's handler. |
src/Core/src/Platform/Windows/SliderExtensions.cs |
Guards against stale thumb-image results and bitmap callbacks. |
src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs |
Defers rendering, handles cancellation, and disposes the text format. |
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kubaflo
added a commit
that referenced
this pull request
Nov 16, 2026
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo
added a commit
that referenced
this pull request
Nov 16, 2026
…e loading (#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for #40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. #39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from #39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
pushed a commit
that referenced
this pull request
Nov 17, 2026
…ng (#39911) <!-- 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 Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash. Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat. ### 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 #39888 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
added a commit
that referenced
this pull request
Nov 17, 2026
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo
added a commit
that referenced
this pull request
Nov 17, 2026
…e loading (#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for #40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. #39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from #39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
pushed a commit
that referenced
this pull request
Nov 18, 2026
…ng (#39911) <!-- 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 Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash. Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat. ### 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 #39888 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
added a commit
that referenced
this pull request
Nov 18, 2026
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo
added a commit
that referenced
this pull request
Nov 18, 2026
…e loading (#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for #40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. #39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from #39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
pushed a commit
that referenced
this pull request
Nov 18, 2026
…ng (#39911) <!-- 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 Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash. Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat. ### 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 #39888 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
added a commit
that referenced
this pull request
Nov 18, 2026
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo
added a commit
that referenced
this pull request
Nov 18, 2026
…e loading (#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for #40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. #39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from #39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
pushed a commit
that referenced
this pull request
Nov 18, 2026
…ng (#39911) <!-- 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 Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash. Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat. ### 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 #39888 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
added a commit
that referenced
this pull request
Nov 18, 2026
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo
added a commit
that referenced
this pull request
Nov 18, 2026
…e loading (#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for #40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. #39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from #39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
pushed a commit
that referenced
this pull request
Nov 19, 2026
…ng (#39911) <!-- 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 Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash. Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat. ### 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 #39888 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
added a commit
that referenced
this pull request
Nov 19, 2026
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo
added a commit
that referenced
this pull request
Nov 19, 2026
…e loading (#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for #40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. #39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from #39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
pushed a commit
that referenced
this pull request
Nov 22, 2026
…ng (#39911) <!-- 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 Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash. Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat. ### 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 #39888 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
added a commit
that referenced
this pull request
Nov 22, 2026
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo
added a commit
that referenced
this pull request
Nov 22, 2026
…e loading (#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for #40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. #39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from #39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
pushed a commit
that referenced
this pull request
Nov 23, 2026
…ng (#39911) <!-- 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 Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash. Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat. ### 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 #39888 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
kubaflo
added a commit
that referenced
this pull request
Nov 23, 2026
### Description of Change Fix Windows build failures introduced by the image-loading changes in #39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes #40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo
added a commit
that referenced
this pull request
Nov 23, 2026
…e loading (#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for #40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. #39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from #39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
KarthikRajaKalaimani
pushed a commit
to KarthikRajaKalaimani/maui
that referenced
this pull request
Nov 26, 2026
…ng (dotnet#39911) <!-- 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 Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash. Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat. ### 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 dotnet#39888 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
KarthikRajaKalaimani
pushed a commit
to KarthikRajaKalaimani/maui
that referenced
this pull request
Nov 26, 2026
…#40173) ### Description of Change Fix Windows build failures introduced by the image-loading changes in dotnet#39911. - Use an explicit reference-identity comparison between the Slider handler’s platform view and the native slider, resolving **CS0252**. - Remove the unnecessary null-conditional access to `nativeImageSource.Value` after the existing null guard, resolving **CS8602** in the cleanup callback. These changes preserve the image-request lifecycle checks and resource cleanup without suppressing compiler warnings ### Issues Fixed Fixes dotnet#40116 Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
KarthikRajaKalaimani
pushed a commit
to KarthikRajaKalaimani/maui
that referenced
this pull request
Nov 26, 2026
…e loading (dotnet#40203) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is the explicitly requested candidate-regression correction for dotnet#40116, targeting `candidate/11.0.1xx-sr2`, not an automatically selected staging target. ### Description of Change <!-- Enter description of the fix in this section --> Preserve Windows Button image/text spacing when its image loads asynchronously. `DefaultMauiButtonContent` previously cached `AdjustSpacing(spacing)` while mapping `ContentLayout`. The image is initially collapsed, so an asynchronously loaded image can permanently cache zero spacing. dotnet#39911 makes this observable for font images by yielding before rendering to avoid WinUI layout/STA reentrancy. Store the configured spacing unchanged, then resolve effective spacing against current image/text visibility during measure and both arrange paths. This restores left/right/top/bottom gaps and continues to omit the gap for image-only or text-only content. The entire production change is confined to `src/Core/src/Platform/Windows/MauiButton.cs`. The font-rendering deferral, cancellation checks, and resource disposal from dotnet#39911 are unchanged. No mapper callbacks, snapshot updates, tolerances, assertions, retries, timeouts, test filters, or pipeline configuration are changed. There is no public API change. #### Native Windows evidence Validated commit: `e9ba65ec8c1d53f2c01457fa622e46e2bfda69e2`, based on candidate `08fbadc06fb09ac8072b09e957984234045cbd2d`. The candidate head was rechecked before publication. | Unchanged regression oracle | Candidate build 1678469 | Corrected build 1678597 | | --- | --- | --- | | `Issue21202(Windows).Issue21202Test` | Failed, 4.45% difference, including retry | Passed, run 46792972 / result 100202 | | `Issue22433(Windows).ButtonLayoutAndSpacingTests` | Failed, 2.23% difference, including retry | Passed, run 46792972 / result 100048 | [Corrected native Windows run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1678597) used the existing pipeline 313 `stagesToSkip` option to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchanged `Border,BoxView,Brush,Button` shard completed with **219 passed, 2 skipped, 0 failed**; its [published results](https://dev.azure.com/dnceng-public/public/_TestManagement/Runs?runId=46792972&_a=runCharts) contain all 221 results. `ButtonLayoutAndSpacingTests` exercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing. Raw Azure logs were retrieved through `az devops invoke` and inspected: [Button-shard execution, log 1221](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1221), [publication, log 1223](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1678597/logs/1223), and native compilation logs 53/76. Both focal methods passed in each of the five supplied `net11` baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used source `e181a663463723a772daf45b4d875c022d066d67`. All four Windows snapshot blobs used by these methods are identical between that source, the candidate, and this fix; this is a product correction, not a baseline refresh. **Remaining limitations:** the overall corrected Windows run is failed, not green: `Issue8308.NavigatingBackToCollectionViewShouldNotCrash` still fails in CV1 and CV2 (runs 46792350 and 46791982, result 100048 in each). That independently owned Shell automation-ID repair is deliberately not included. Other platforms were not run for this Windows-only correction. Evidence obtained is candidate red -> one-file fix green; no trigger-removal or fix-reversion/restoration run was performed. Passing focal results have no retained image attachments, so screenshot validation is evidenced by the unchanged native snapshot assertions, not a newly exported after-image. Local validation: `dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Windows/MauiButton.cs --verbosity quiet` passed; `git diff --check` passed. Upstream open/recently merged PR searches for `MauiButton`, `ContentLayout`, Button spacing, and asynchronous image spacing found no owning correction to reuse. ### 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. --> Relates to dotnet#40116. Follows up dotnet#39911 without reverting its crash prevention for dotnet#39888. Uses the existing dotnet#21202 and dotnet#22433 regression oracles unchanged. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 29, 2026
kubaflo
added a commit
that referenced
this pull request
Nov 29, 2026
…40802) <!-- copilot-assessment:v1 --> ### Agent assessment Self-reported assessment, not an independent review. Assessed revision: `e9964a9acf9cfa240b69eba1155898bc524dcc6b` | Dimension | Assessment | Rationale | |---|---|---| | Change confidence | 8/10 | ↑ Deferral is compiled only for Windows; other platforms retain main's completion behavior.<br>↑ 350 navigation unit tests pass, including the non-Windows ordering regression test.<br>↑ Build 1704240 validates iOS General and Windows NavigationPage in both packaging modes at this exact head.<br>↓ The first scoped-head run still had iOS failures; an unchanged-head retry passed, so native environment variability remains relevant. | | Diagnosis confidence | 7/10 | ↑ WinUI completes navigation inside Loaded, where inline callers can immediately close the window.<br>↑ The Windows-only change retains success of the original crash test in both packaging modes.<br>↑ Non-Windows callback ordering is restored and unit-tested.<br>↓ The original Windows native faulting module is unknown; the 17 iOS failures cannot all be causally attributed to deferral, since they also occurred once with this scoped head. | | Evidence fit | 8/10 | ↑ Build 1704240 genuine TRX: iOS General 1479 passed/0 failed/14 existing skips, including all 17 previously failing cases.<br>↑ Both Windows NavigationPage categories: 16 passed/0 failed/3 existing skips, and the original test explicitly Passed (242 ms packaged, 240 ms unpackaged).<br>↓ Build 1704232's first scoped-head iOS result was red; the green validation is the unchanged-head retry 1704240, not that earlier run. | <!-- /copilot-assessment --> <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting): `main`, explicitly requested for the .NET 12 Windows CI failure. For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> On **Windows only**, create the active `NavigationPage` request completion source with `RunContinuationsAsynchronously`. Other platforms retain the original completion source and native callback ordering. On Windows, `StackNavigationManager.OnNavigated` completes the request from WinUI's `Loaded` callback. Previously, `SetResult` could synchronously run the entire navigation continuation and its caller while that native callback was still on the stack. In `SettingTitleIconImageSourceDoesntCrash`, this includes updating the toolbar image and immediately closing/destroying the window through `CreateHandlerAndAddToWindow`. Queueing continuations lets the native completion callback unwind first. The updated portable unit test uses a manually completed handler and verifies that non-Windows `NavigatedTo` retains its original synchronous native callback ordering. It fails against this PR's earlier unscoped deferral and passes with the Windows-only correction. The existing Windows device test is unchanged: no skip, delay, image substitution, or reduced coverage. Baseline: [build 1704198](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1704198), Windows Controls packaged [log 760](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1704198/logs/760?api-version=7.1), 11:38:15–11:38:38 UTC. The recovered TRX contains one passed test; the sequence starts `SettingTitleIconImageSourceDoesntCrash` without an end event. The process exits 57005 (0xDEAD), MTP exits 7. The artifact contains no `.dmp`, and `windows-application-events.json` is empty. No faulting module or native exception is known. The supplied additional baseline builds are 1704155, 1703964 and 1704185. Duplicate search covered open and recently merged PRs across main, net11, release, candidate and inflight branches for this test, title icons, PageControl, StackNavigationManager, teardown, and navigation continuations. This is not #40795's initial-navigation event guard (already on main), nor #39911's stale image-result guard (also already on main). Validation (latest revision, configured SDK `12.0.100-alpha.1.26523.103`, macOS): ```sh dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj \ -p:IncludeAndroidTargetFrameworks=false -p:IncludeIosTargetFrameworks=false \ -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false \ -p:IncludeWindowsTargetFrameworks=false \ --filter-method '*NonWindowsNavigationCompletionPreservesNativeCallbackOrdering' --verbosity quiet ``` - Before scoping the fix: **failed**, `Assert.True`, actual `False` (1 test), proving the unscoped PR changes non-Windows ordering. - After scoping, same command with `--filter-method '*Navigation*'`: **passed**, 350/350. - `dotnet format whitespace --folder --include src/Controls/src/Core/NavigationPage/NavigationPage.cs src/Controls/tests/Core.UnitTests/NavigationPageLifecycleTests.cs --verbosity quiet`: **passed**. - `git diff --check`: **passed**. - Latest-head native iOS/Windows CI: **validated in build 1704240** below; not run locally. #### Native CI history and regression correction [Build 1704212](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1704212) tested the **previous** head `c4da77aa65cbec06d93b41a8c4b0b6ae69f219e6` (merge `6da2433c9f8cde06366718a44c461b11bc97caf7`): - Windows NavigationPage passed in both modes: 16 passed, 0 failed, 3 existing skips each. Both genuine TRX files explicitly mark `SettingTitleIconImageSourceDoesntCrash` Passed (148 ms packaged, 189 ms unpackaged). [Packaged log 760](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1704212/logs/760?api-version=7.1); [unpackaged log 739](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1704212/logs/739?api-version=7.1). - **Observed failures:** iOS Controls CoreCLR General [log 727](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1704212/logs/727?api-version=7.1) failed 17/1493 tests: TabbedPage background transitions, NavigationPage back-button observation, More-tab PageTransitions, and ScrollView horizontal options. The unscoped deferral changed non-Windows callback ordering (confirmed by the unit test); this revision restores main's behavior outside Windows. The 17 native failures are not conclusively all caused by that ordering change: they also recurred in the first Windows-only run before passing on the unchanged-head retry. - The reported Windows unpackaged Shell crash and Windows BlazorWebView initialization failure also occur on main / are known flakes; they are outside this fix and are not modified or hidden. - Build 1704210 was canceled before execution and is not validation evidence. #### Latest-head native validation: build 1704240 [Build 1704240](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1704240) validates head `e9964a9acf9cfa240b69eba1155898bc524dcc6b` through merge `4edb3a18f4e96fe3be0f866b887b506e1a42a221`. | Selected coverage | Actual result | Raw task log | | --- | --- | --- | | iOS Controls CoreCLR General | 1479 passed, 0 failed, 14 existing skips; job succeeded | [736](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1704240/logs/736?api-version=7.1) | | Windows Controls packaged NavigationPage | 16 passed, 0 failed, 3 existing skips; category exit 0 | [745](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1704240/logs/745?api-version=7.1) | | Windows Controls unpackaged NavigationPage | 16 passed, 0 failed, 3 existing skips; category exit 0 | [739](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1704240/logs/739?api-version=7.1) | The genuine iOS `native/testResults.trx` confirms all 17 previously failing cases individually **Passed**. Both Windows `categories/NavigationPage/Controls-NavigationPage.trx` files explicitly record `SettingTitleIconImageSourceDoesntCrash` **Passed** (242 ms packaged, 240 ms unpackaged). No native device tests were changed or newly skipped. **First-run caveat:** build 1704232 tested the same scoped head and still had the same 17 iOS failures (log 736), despite compiling IOS rather than WINDOWS and retaining main's non-Windows code. Compared with green main 1704155, its simulator log records a different iOS 27.2 runtime build (`SimulatorRuntime-v24.2.91016.19` versus `v24.2.8117.0`), and provisioning ends with `Data Migration Failed`. These differences support native environment variability, not a proven root cause of every failure. The subsequent 1704240 run was an **unchanged-head retry**, not another product fix. The packaged Windows job in 1704240 still fails in the separate Shell category (exit 7); NavigationPage passes. The known Shell/BlazorWebView failures are not fixed or hidden here. This is validation of the requested iOS General and Windows NavigationPage coverage, not a full-CI-green claim. ### 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. --> Addresses the Windows Controls `SettingTitleIconImageSourceDoesntCrash` CI host crash described above; no separate issue was supplied. Related investigation: #40795, not a replacement or duplicate of its net11 fix. ### Let AI finish this PR - [ ] **Let the MAUI agent address review feedback and fix remaining issues on this PR.** Maintainers still decide whether it is merged. For PRs from forks, the agent opens a follow-up PR that keeps your commits. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

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 of Change
Custom font loading can pump STA messages. Performing that work synchronously during a XAML layout tick can cause dispatcher reentrancy and a native WinUI fail-fast crash.
Defer font-image rendering with Task.Yield() before entering the existing Win2D rendering pipeline. This preserves UI-thread rendering while allowing the current layout tick to finish. Also honor cancellation before rendering and after the yield, avoid logging expected cancellation as a warning, and dispose CanvasTextFormat.
Issues Fixed
Fixes #39888