Repository navigation
[Windows] Preserve Button image/text spacing during asynchronous image loading - #40203
Merged
Merged
Conversation
Keep configured content spacing and resolve image/text visibility during measure and arrange instead of caching zero before an async font image loads. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
temporarily deployed
to
copilot-pat-pool
November 12, 2026 23:33 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
November 12, 2026 23:33 — with
GitHub Actions
Inactive
This comment has been minimized.
This comment has been minimized.
kubaflo
temporarily deployed
to
copilot-pat-pool
November 12, 2026 23:34 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
November 12, 2026 23:36 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
November 12, 2026 23:37 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
November 12, 2026 23:38 — with
GitHub Actions
Inactive
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
/rebase |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Collaborator
PR Test Gate
🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. No interpretable test-group summary was produced. No additional test execution is inferred. Setup did not capture a verified PR head; no commit is claimed as tested. No immutable without-fix baseline was prepared. |
Contributor
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit e9ba65e.
1 task
4 tasks
Open
3 tasks
kubaflo
added a commit
that referenced
this pull request
Nov 13, 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
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
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
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
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
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
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
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
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
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
…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 branch was previously deployed
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!
Target Branch
mainnet11, for reviewFor .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
Preserve Windows Button image/text spacing when its image loads asynchronously.
DefaultMauiButtonContentpreviously cachedAdjustSpacing(spacing)while mappingContentLayout. 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 candidate08fbadc06fb09ac8072b09e957984234045cbd2d. The candidate head was rechecked before publication.Issue21202(Windows).Issue21202TestIssue22433(Windows).ButtonLayoutAndSpacingTestsCorrected native Windows run used the existing pipeline 313
stagesToSkipoption to exclude non-Windows stages, not invented test-filter parameters. Both Windows host-app builds succeeded. The unchangedBorder,BoxView,Brush,Buttonshard completed with 219 passed, 2 skipped, 0 failed; its published results contain all 221 results.ButtonLayoutAndSpacingTestsexercises the Default, Layout, and Spacing screenshots, including all four image positions and custom spacing.Raw Azure logs were retrieved through
az devops invokeand inspected: Button-shard execution, log 1221, publication, log 1223, and native compilation logs 53/76.Both focal methods passed in each of the five supplied
net11baseline runs: 46719362, 46602928, 46587802, 46581236, and 46559036. The latest passing baseline build 1676275 used sourcee181a663463723a772daf45b4d875c022d066d67. 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.NavigatingBackToCollectionViewShouldNotCrashstill 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 quietpassed;git diff --checkpassed.Upstream open/recently merged PR searches for
MauiButton,ContentLayout, Button spacing, and asynchronous image spacing found no owning correction to reuse.Issues Fixed
Relates to #40116. Follows up #39911 without reverting its crash prevention for #39888. Uses the existing #21202 and #22433 regression oracles unchanged.