Skip to content

[iOS & Mac] Fix image tile misalignment in GraphicsView ImagePaint#34935

Merged
kubaflo merged 5 commits intodotnet:inflight/currentfrom
SubhikshaSf4851:Fix34755
Apr 24, 2026
Merged

[iOS & Mac] Fix image tile misalignment in GraphicsView ImagePaint#34935
kubaflo merged 5 commits intodotnet:inflight/currentfrom
SubhikshaSf4851:Fix34755

Conversation

@SubhikshaSf4851
Copy link
Copy Markdown
Contributor

@SubhikshaSf4851 SubhikshaSf4851 commented Apr 13, 2026

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 whether this change resolves your issue. Thank you!

Root Cause :

The image tiling issue was caused by an incorrect pattern phase in PlatformCanvas.FillWithImage. The phase was not aligned with the fill rectangle’s origin, so the tile pattern started from an offset position — resulting in misaligned and split image tiles across the fill area.

Description of Change

Graphics rendering improvements (macOS):

  • PlatformCanvas.cs: Added calls to _context.SetPatternPhase(CGSize.Empty) in both FillWithPattern and FillWithImage methods to reset the pattern phase, ensuring patterns and image tiles start at the correct origin and are not misaligned within the fill rectangle. [1] [2]

Test Code Cleanup:

  • Issue16767_Resize.cs: Re-enabled the ImagePaintWithResizeModeFit UI test on iOS by removing the conditional compilation block, allowing this test to run on all platforms.

Issues Fixed

Fixes #34755

Tested the behavior in the following platforms

  • Windows
  • Android
  • iOS
  • Mac
Before Issue Fix After Issue Fix
Simulator Screenshot - iPhone Xs - 2026-04-14 at 12 52 59 Simulator Screenshot - iPhone Xs - 2026-04-14 at 12 52 06

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://github.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34935

Or

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

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Apr 13, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hey there @@SubhikshaSf4851! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Apr 13, 2026
@NirmalKumarYuvaraj NirmalKumarYuvaraj added area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing and removed area-controls-image Image control labels Apr 14, 2026
@SubhikshaSf4851 SubhikshaSf4851 changed the title Fix ResizeMode not rendered correctly in iOS [iOS & Mac] Fix image tile misalignment in GraphicsView ImagePaint Apr 14, 2026
@sheiksyedm sheiksyedm marked this pull request as ready for review April 14, 2026 08:15
Copilot AI review requested due to automatic review settings April 14, 2026 08:15
@sheiksyedm
Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests , maui-pr-devicetests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes GraphicsView ImagePaint tiling alignment issues on iOS/macOS by resetting the CoreGraphics pattern phase to the fill-rect origin, and re-enables the previously-disabled iOS UI screenshot test by updating the iOS baselines.

Changes:

  • Reset CGContext pattern phase inside PlatformCanvas.FillWithPattern / FillWithImage to align tiles to the fill origin.
  • Enable ImagePaintWithResizeModeFit UI test on iOS by removing the conditional compilation guard.
  • Update iOS and iOS-26 screenshot baselines for ImagePaintWithResizeModeFit.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Graphics/src/Graphics/Platforms/MaciOS/PlatformCanvas.cs Resets pattern phase for pattern/image fills to prevent tiling offsets/misalignment.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16767_Resize.cs Enables the Fit screenshot test on iOS (removed #if TEST_FAILS_ON_IOS).
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ImagePaintWithResizeModeFit.png Updates iOS baseline screenshot to match corrected rendering.
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ImagePaintWithResizeModeFit.png Updates iOS-26 baseline screenshot to match corrected rendering.

Comment thread src/Graphics/src/Graphics/Platforms/MaciOS/PlatformCanvas.cs Outdated
Comment thread src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16767_Resize.cs Outdated
@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Apr 15, 2026
@sheiksyedm
Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests , maui-pr-devicetests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Copy Markdown
Contributor

@kubaflo kubaflo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the tests are failing - could you please have a look?

@MauiBot MauiBot added s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates and removed s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR labels Apr 20, 2026
@dotnet dotnet deleted a comment from MauiBot Apr 22, 2026
@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues and removed s/agent-approved AI agent recommends approval - PR fix is correct and optimal labels Apr 23, 2026
@dotnet dotnet deleted a comment from MauiBot Apr 23, 2026
@kubaflo kubaflo changed the base branch from main to inflight/current April 24, 2026 10:33
@kubaflo kubaflo merged commit c23c915 into dotnet:inflight/current Apr 24, 2026
23 of 31 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR7 milestone Apr 24, 2026
@dotnet dotnet deleted a comment from MauiBot Apr 24, 2026
@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Apr 24, 2026

🤖 AI Summary

👋 @SubhikshaSf4851 — new AI review results are available. Please review the latest session below.

📊 Review Session3272fb9 · updated mac snapshots · 2026-04-24 15:35 UTC
🚦 Gate — Test Before & After Fix

Test Verification Report

Date: 2026-04-24 14:46:55 | Platform: ANDROID | Status: ✅ PASSED

Summary

Check Expected Actual Result
Tests WITHOUT fix FAIL FAIL
Tests WITH fix PASS PASS

✅ Final Verdict

VERIFICATION PASSED

The tests correctly detect the issue:

  • ✅ Tests FAIL without the fix (as expected - bug is present)
  • ✅ Tests PASS with the fix (as expected - bug is fixed)

Conclusion: The tests properly validate the fix and catch the bug when it's present.


Configuration

Platform: android
Test Filter: Issue16767_Resize
Base Branch: main
Merge Base: a9b817f

Fix Files

  • src/Graphics/src/Graphics/Platforms/MaciOS/PlatformCanvas.cs

Test Results Details

Test Run 1: WITHOUT Fix

Expected: Tests should FAIL (bug is present)
Actual: Tests FAILED ✅

Test Summary:

  • Total:
  • Passed: False
  • Failed:
  • Skipped:
View full test output (without fix)
  Determining projects to restore...
  Restored /home/vsts/work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 1.02 sec).
  Restored /home/vsts/work/1/s/src/Essentials/src/Essentials.csproj (in 5.07 sec).
  Restored /home/vsts/work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 2.32 sec).
  Restored /home/vsts/work/1/s/src/Core/src/Core.csproj (in 6.21 sec).
  Restored /home/vsts/work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 53 ms).
  Restored /home/vsts/work/1/s/src/Controls/Foldable/src/Controls.Foldable.csproj (in 435 ms).
  Restored /home/vsts/work/1/s/src/Controls/Maps/src/Controls.Maps.csproj (in 1.41 sec).
  Restored /home/vsts/work/1/s/src/Core/maps/src/Maps.csproj (in 41 ms).
  Restored /home/vsts/work/1/s/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 2.12 sec).
  Restored /home/vsts/work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj (in 70 ms).
  Restored /home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj (in 1.22 sec).
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0-android36.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0-android36.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0-android36.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Maps -> /home/vsts/work/1/s/artifacts/bin/Maps/Debug/net10.0-android36.0/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-android36.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-android36.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Xaml.dll
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Foldable.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Maps.dll
  Controls.TestCases.HostApp -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Controls.TestCases.HostApp.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Maps.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Xaml.dll
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Maps.dll
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Foldable.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:06:45.57
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0


Test Run 2: WITH Fix

Expected: Tests should PASS (bug is fixed)
Actual: Tests PASSED ✅

Test Summary:

  • Total:
  • Passed: True
  • Failed:
  • Skipped:
View full test output (with fix)
  Determining projects to restore...
  All projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0-android36.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0-android36.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0-android36.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Maps -> /home/vsts/work/1/s/artifacts/bin/Maps/Debug/net10.0-android36.0/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-android36.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-android36.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Foldable.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Xaml.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Maps.dll
  Controls.TestCases.HostApp -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Controls.TestCases.HostApp.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Xaml.dll
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Maps.dll
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Foldable.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.AspNetCore.Components.WebView.Maui.dll
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Failure calling service package: Broken pipe (32) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:  [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass105_0.<InstallPackage>b__0(Task`1 t) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: --- End of stack trace from previous location --- [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: --- End of stack trace from previous location --- [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at AndroidDeviceExtensions.PushAndInstallPackageAsync(AndroidDevice device, PushAndInstallCommand command, CancellationToken token) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at AndroidDeviceExtensions.PushAndInstallPackageAsync(AndroidDevice device, PushAndInstallCommand command, CancellationToken token) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.InstallPackage(Boolean installed) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.InstallPackage(Boolean installed) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.RunInstall() [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]

Build FAILED.

/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Failure calling service package: Broken pipe (32) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:  [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass105_0.<InstallPackage>b__0(Task`1 t) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: --- End of stack trace from previous location --- [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: --- End of stack trace from previous location --- [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at AndroidDeviceExtensions.PushAndInstallPackageAsync(AndroidDevice device, PushAndInstallCommand command, CancellationToken token) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at AndroidDeviceExtensions.PushAndInstallPackageAsync(AndroidDevice device, PushAndInstallCommand command, CancellationToken token) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.InstallPackage(Boolean installed) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.InstallPackage(Boolean installed) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.RunInstall() [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:11:13.54
* daemon not running; starting now at tcp:5037
* daemon started successfully
  Determining projects to restore...
  All projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0-android36.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0-android36.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0-android36.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Maps -> /home/vsts/work/1/s/artifacts/bin/Maps/Debug/net10.0-android36.0/Microsoft.Maui.Maps.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-android36.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Foldable.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-android36.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Maps.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Xaml.dll
  Controls.TestCases.HostApp -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Controls.TestCases.HostApp.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Maps.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Foldable.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Xaml.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.AspNetCore.Components.WebView.Maui.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13928752
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Maps.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:08:17.40
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0


Logs

  • Full verification log: /home/vsts/work/1/s/CustomAgentLogsTmp/PRState/34935/PRAgent/gate/verify-tests-fail/verification-log.txt
  • Test output without fix: /home/vsts/work/1/s/CustomAgentLogsTmp/PRState/34935/PRAgent/gate/verify-tests-fail/test-without-fix.log
  • Test output with fix: /home/vsts/work/1/s/CustomAgentLogsTmp/PRState/34935/PRAgent/gate/verify-tests-fail/test-with-fix.log
  • UI test logs: CustomAgentLogsTmp/UITests/

🧪 UI Tests — Category Detection

Detected UI test categories: GraphicsView


🔍 Pre-Flight — Context & Validation

Issue: #34755 - [iOS] Image resized with ResizeMode.Fit is not rendered correctly in GraphicsView
PR: #34935 - [iOS & Mac] Fix image tile misalignment in GraphicsView ImagePaint
Platforms Affected: iOS, macOS (MacCatalyst)
Files Changed: 1 implementation (PlatformCanvas.cs), 1 test (Issue16767_Resize.cs), 10 snapshot PNG files

Key Findings

  • Root cause: PlatformCanvas.FillWithImage (and FillWithPattern) inherit the PatternPhase set by PlatformGraphicsView on the rendering context. Since these methods already apply their own translation transforms (CGAffineTransform.MakeTranslation(x, y)), the view-level phase causes a double-offset, causing image tiles to split across the fill rect.
  • Fix: Call _context.SetPatternPhase(CGSize.Empty) at the start of both FillWithPattern and FillWithImage, inside the existing SaveState/RestoreState scope — so the reset is local to each fill operation.
  • Test change: Removes #if TEST_FAILS_ON_IOS guard from ImagePaintWithResizeModeFit test (the bug is now fixed), adds new iOS snapshot baselines (ios/ and ios-26/).
  • PR was already merged into inflight/current on 2026-04-24 by kubaflo.
  • Prior inline review: Copilot PR reviewer suggested rewording the comment to say "The view's PatternPhase" instead of hard-coding coordinates — the author accepted and applied that suggestion.
  • A BOM character in the test file was also flagged and fixed.

Code Review Summary

Verdict: LGTM
Confidence: high
Errors: 0 | Warnings: 0 | Suggestions: 2

Key code review findings:

  • 💡 FillWithPattern path on iOS has no dedicated test re-enabled — the fix is logically sound but this path lacks a regression guard on iOS (existing gap, not introduced here)
  • 💡 Android/Windows paths are correctly untouched; no snapshot updates needed for those platforms

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #34935 Reset PatternPhase to CGSize.Empty in FillWithPattern and FillWithImage inside SaveState/RestoreState ✅ PASSED (Gate) PlatformCanvas.cs + Issue16767_Resize.cs + snapshots Original PR, already merged

🔬 Code Review — Deep Analysis

Code Review — PR #34935

Independent Assessment

What this changes: Adds _context.SetPatternPhase(CGSize.Empty) at the top of both FillWithPattern and FillWithImage in MaciOS/PlatformCanvas.cs (inside existing SaveState/RestoreState blocks), and removes a #if TEST_FAILS_ON_IOS guard from one UI test method, with new iOS snapshot baselines.

Inferred motivation: The PlatformGraphicsView pre-sets PatternPhase on the graphics context (using Frame.X, Frame.Y on iOS; Frame.X, Frame.Height + Frame.Y on Mac) to align tiled patterns with window coordinates. However, both FillWithImage and FillWithPattern already apply their own translation transforms to position the pattern at the fill rect origin — so the inherited PatternPhase double-offsets the tile, causing it to start at the wrong position and visually split across the fill rectangle. Resetting the phase to CGSize.Empty before filling, while scoped inside SaveState/RestoreState, corrects this.


Reconciliation with PR Narrative

Author claims: Root cause is PlatformCanvas.FillWithImage inheriting an incorrect pattern phase from the view. Fix resets phase to empty in both FillWithPattern and FillWithImage. Re-enables the ImagePaintWithResizeModeFit test on iOS.

Agreement: Fully consistent with the code. The root cause diagnosis is correct and the fix is scoped properly. Before/after screenshots in the PR confirm the visual regression was real.


Findings

💡 Suggestion — FillWithPattern fix not covered by any test re-enablement

FillWithPattern (line 713) gets the same SetPatternPhase(CGSize.Empty) fix as FillWithImage, but no test with a PatternPaint scenario was re-enabled or updated. The Mac ImagePaintShouldBeDrawn.png snapshot did change (indicating the ImagePaint baseline shifted), but there is no corresponding visible test for a tiled pattern on iOS. This isn't a correctness concern — the fix is logically sound for both methods — but it's worth noting the FillWithPattern path has no regression guard on iOS. Existing Mac snapshots presumably cover this.

💡 Suggestion — Android/Windows platforms untouched (expected, but worth noting)

MaciOS/PlatformCanvas.cs compiles for iOS + MacCatalyst only. No Android or Windows rendering paths were changed, and no snapshots for those platforms were updated — which is correct. The test ImagePaintWithResizeModeFit is now unrestricted on iOS but there is no TEST_FAILS_ON_ANDROID guard to consider, confirming Android was always passing.


Devil's Advocate

"Could resetting PatternPhase to empty break valid existing pattern fills?" — No. The reset happens inside SaveState/RestoreState, so it only affects this fill operation. The context phase is restored after FillRect completes. The pattern transforms handle their own origin positioning via CGAffineTransform.MakeTranslation(x, y), so the parent-set phase was always redundant (and in this case, harmful) for these fill methods.

"Is the MaciOS fix sufficient for the Mac AppKit path?" — Not a concern here. The Mac AppKit path handles pattern phase independently. The Mac snapshot tests pass with the change, confirming the fix applies to the Mac Catalyst path used by TestCases.Mac.Tests.

"Does re-enabling the iOS test without a #if TEST_FAILS_ON_CATALYST guard risk Catalyst flakes?" — The new ios-26/ImagePaintWithResizeModeFit.png snapshot confirms that iOS 26 was explicitly baselined. CI is fully green.


CI Status

✅ All required checks pass. maui-pr passed including macOS Debug/Release builds and all integration test variants.


Verdict: LGTM

Confidence: high

Summary: The fix is minimal and surgically correct. Scoping SetPatternPhase(CGSize.Empty) inside the pre-existing SaveState/RestoreState blocks is exactly the right approach — it overrides the view's pattern phase locally for these fill operations without affecting the broader context. Snapshot baselines have been properly regenerated for both iOS (regular + ios-26) and Mac, and all CI is green. The only observations are informational (no new test for the FillWithPattern path on iOS, which is an existing gap rather than a regression introduced here).


🔧 Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 try-fix (claude-opus-4.6) Remove SetPatternPhase(PatternPhase) from PlatformGraphicsView.Draw() on iOS and Mac ✅ PASS 2 files (0 additions, 2 deletions) Caller-level fix; simpler but may affect subclasses relying on PatternPhase
2 try-fix (claude-sonnet-4.6) Reset PatternPhase in DirectRenderer.Draw() on iOS and Mac (renderer-boundary reset) ✅ PASS 2 files (+4 lines each) Architectural boundary fix; preserves PlatformGraphicsView call while neutralizing it for IDrawable
3 try-fix (gpt-5.3-codex) Remove x,y translation from CGPattern transform in FillWithPattern/FillWithImage, rely on existing canvas transform only ✅ PASS 1 file (+2/-6) Pure transform-based approach with no phase changes
4 try-fix (gpt-5.4) Set PatternPhase property to CGSize.Empty in PlatformGraphicsView on iOS and Mac ✅ PASS 2 files (+1/-6) Source-level fix; changes view behavior globally
PR PR #34935 SetPatternPhase(CGSize.Empty) inside FillWithPattern and FillWithImage (callee-level reset inside SaveState/RestoreState) ✅ PASSED (Gate) 1 file + snapshots Original PR, already merged

Cross-Pollination

Model Round New Ideas? Details
claude-opus-4.6 2 No "NO NEW IDEAS" — 5 approaches exhaustively cover all fix levels (source, intermediate, callee, transform).

Exhausted: Yes
Selected Fix: PR's fix — SetPatternPhase(CGSize.Empty) inside FillWithPattern and FillWithImage in PlatformCanvas.cs.

Reason: The PR's fix is the most targeted and defensive approach: scoped inside existing SaveState/RestoreState blocks so it only affects the specific fill operation, preserves PlatformGraphicsView's phase behavior for non-canvas drawing, modifies the minimum number of files (1), and explicitly documents the intent. Attempts 1 and 4 change the view's general phase behavior (potential regression risk for non-pattern drawing). Attempt 2 is valid but touches more files. Attempt 3 changes fundamental transform composition with more risk.


📋 Report — Final Recommendation

✅ Final Recommendation: APPROVE

Phase Status

Phase Status Notes
Pre-Flight ✅ COMPLETE Issue #34755 + PR #34935 context gathered; 1 impl file + 10 snapshots
Code Review LGTM (high) 0 errors, 0 warnings, 2 informational suggestions
Gate ✅ PASSED android
Try-Fix ✅ COMPLETE 4 attempts, 4 passing
Report ✅ COMPLETE

Code Review Impact on Try-Fix

Code review returned LGTM with no errors or warnings — only two informational suggestions (no iOS test for FillWithPattern path, Android/Windows unaffected). No failure-mode probes flagged issues requiring investigation. The LGTM verdict meant try-fix exploration was unconstrained — models were free to explore any alternative approach rather than needing to address specific defects. All 4 alternative approaches independently verified the fix is correct.

Summary

PR #34935 fixes a rendering bug in GraphicsView on iOS and macOS where image tiles (and pattern fills) were misaligned due to a PatternPhase double-offset. The fix is minimal, well-scoped, and already merged. Gate passed, code review is LGTM, and 4 independent fix explorations all validated the correctness of the approach (with the PR's fix being the most targeted).

Root Cause

PlatformGraphicsView pre-sets the CGContext's PatternPhase to the view's frame origin (Frame.X, Frame.Y on iOS; Frame.X, Frame.Height + Frame.Y on Mac) to align native tiled fills with window coordinates. However, FillWithImage and FillWithPattern in PlatformCanvas.cs already apply their own CGAffineTransform.MakeTranslation(x, y) to position patterns correctly within the fill rect. This causes a double-offset: the tile starts at the wrong origin and visually splits across the fill rectangle.

Fix Quality

The PR's fix (_context.SetPatternPhase(CGSize.Empty) inside SaveState/RestoreState in both FillWithPattern and FillWithImage) is the optimal approach among 5 explored alternatives:

  • Minimally scoped: Reset happens inside existing SaveState/RestoreState blocks, affecting only the current fill operation — the broader context's PatternPhase is untouched
  • Preserves existing behavior: PlatformGraphicsView's phase-setting for native UIColor/NSColor pattern fills is left intact, unlike Attempts 1 and 4 which change the view's general phase behavior
  • Single-file change: Only PlatformCanvas.cs is modified, unlike Attempts 1, 2, and 4 which modify PlatformGraphicsView or DirectRenderer files
  • Self-documenting: Clear comment explains the WHY (PR reviewer suggestion was incorporated)
  • Snapshot baselines: iOS (regular + ios-26) and Mac snapshots properly updated; all CI green

Selected Fix: PR's fix


@MauiBot MauiBot added s/agent-approved AI agent recommends approval - PR fix is correct and optimal and removed s/agent-changes-requested AI agent recommends changes - found a better alternative or issues labels Apr 24, 2026
PureWeen pushed a commit that referenced this pull request Apr 28, 2026
…34935)

<!-- Please keep the note below for people who 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 whether this change resolves your
issue. Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
 
### Root Cause : 
The image tiling issue was caused by an incorrect pattern phase in
`PlatformCanvas.FillWithImage`. The phase was not aligned with the fill
rectangle’s origin, so the tile pattern started from an offset position
— resulting in misaligned and split image tiles across the fill area.
### Description of Change

**Graphics rendering improvements (macOS):**
*
[`PlatformCanvas.cs`](diffhunk://#diff-45a7db3ceed514d15d921b3789f56ae949b4f433ab4c5f988ea2aef69b6ef3dfR711-R714):
Added calls to `_context.SetPatternPhase(CGSize.Empty)` in both
`FillWithPattern` and `FillWithImage` methods to reset the pattern
phase, ensuring patterns and image tiles start at the correct origin and
are not misaligned within the fill rectangle.
[[1]](diffhunk://#diff-45a7db3ceed514d15d921b3789f56ae949b4f433ab4c5f988ea2aef69b6ef3dfR711-R714)
[[2]](diffhunk://#diff-45a7db3ceed514d15d921b3789f56ae949b4f433ab4c5f988ea2aef69b6ef3dfR748-R753)
 
**Test Code Cleanup:**

*
[`Issue16767_Resize.cs`](diffhunk://#diff-5cd9b0108cf3bb480e3acc7d1a670c9b55e32c0b5c1fe89de1092e01d34311feL16-L24):
Re-enabled the `ImagePaintWithResizeModeFit` UI test on iOS by removing
the conditional compilation block, allowing this test to run on all
platforms.
<!-- Enter description of the fix in this section -->

### 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 #34755 
### Tested the behavior in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1125" height="2436"
src="https://github.com/user-attachments/assets/afcadca2-74e1-40ba-97a1-779ab3a80de0"
/> | <img width="1125" height="2436"
src="https://github.com/user-attachments/assets/61f5d002-e015-42aa-a546-8d3b663f093a"
/> |
| <img width="1125" height="2436" alt="Simulator Screenshot - iPhone Xs
- 2026-04-14 at 12 52 59"
src="https://github.com/user-attachments/assets/d2b344f2-d529-4380-b3a2-fdb9c958651c"
/> | <img width="1125" height="2436" alt="Simulator Screenshot - iPhone
Xs - 2026-04-14 at 12 52 06"
src="https://github.com/user-attachments/assets/e3f6788a-5b83-42b0-874b-00fbf13cb1dc"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
PureWeen pushed a commit that referenced this pull request Apr 29, 2026
…34935)

<!-- Please keep the note below for people who 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 whether this change resolves your
issue. Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
 
### Root Cause : 
The image tiling issue was caused by an incorrect pattern phase in
`PlatformCanvas.FillWithImage`. The phase was not aligned with the fill
rectangle’s origin, so the tile pattern started from an offset position
— resulting in misaligned and split image tiles across the fill area.
### Description of Change

**Graphics rendering improvements (macOS):**
*
[`PlatformCanvas.cs`](diffhunk://#diff-45a7db3ceed514d15d921b3789f56ae949b4f433ab4c5f988ea2aef69b6ef3dfR711-R714):
Added calls to `_context.SetPatternPhase(CGSize.Empty)` in both
`FillWithPattern` and `FillWithImage` methods to reset the pattern
phase, ensuring patterns and image tiles start at the correct origin and
are not misaligned within the fill rectangle.
[[1]](diffhunk://#diff-45a7db3ceed514d15d921b3789f56ae949b4f433ab4c5f988ea2aef69b6ef3dfR711-R714)
[[2]](diffhunk://#diff-45a7db3ceed514d15d921b3789f56ae949b4f433ab4c5f988ea2aef69b6ef3dfR748-R753)
 
**Test Code Cleanup:**

*
[`Issue16767_Resize.cs`](diffhunk://#diff-5cd9b0108cf3bb480e3acc7d1a670c9b55e32c0b5c1fe89de1092e01d34311feL16-L24):
Re-enabled the `ImagePaintWithResizeModeFit` UI test on iOS by removing
the conditional compilation block, allowing this test to run on all
platforms.
<!-- Enter description of the fix in this section -->

### 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 #34755 
### Tested the behavior in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [x] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="1125" height="2436"
src="https://github.com/user-attachments/assets/afcadca2-74e1-40ba-97a1-779ab3a80de0"
/> | <img width="1125" height="2436"
src="https://github.com/user-attachments/assets/61f5d002-e015-42aa-a546-8d3b663f093a"
/> |
| <img width="1125" height="2436" alt="Simulator Screenshot - iPhone Xs
- 2026-04-14 at 12 52 59"
src="https://github.com/user-attachments/assets/d2b344f2-d529-4380-b3a2-fdb9c958651c"
/> | <img width="1125" height="2436" alt="Simulator Screenshot - iPhone
Xs - 2026-04-14 at 12 52 06"
src="https://github.com/user-attachments/assets/e3f6788a-5b83-42b0-874b-00fbf13cb1dc"
/> |
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Image resized with ResizeMode.Fit is not rendered correctly in GraphicsView

7 participants