[iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set to null#34741
[iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set to null#34741Shalini-Ashokan wants to merge 7 commits intodotnet:mainfrom
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34741Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34741" |
|
Hey there @@Shalini-Ashokan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
d42c1b7 to
3264dac
Compare
There was a problem hiding this comment.
Pull request overview
Fixes an iOS/macCatalyst-specific handler behavior where clearing Entry/Editor background (setting BackgroundColor = null) did not restore the native default appearance, by adding platform-specific MapBackground implementations that explicitly reset the native BackgroundColor and remove any background layer.
Changes:
- Add iOS/macCatalyst
EntryHandler.MapBackgroundandEditorHandler.MapBackgroundto properly handleBackground.IsNullOrEmpty()resets. - Update
PublicAPI.Unshipped.txtfornet-iosandnet-maccatalystto include the new handler mapping APIs. - Add a new UI test page + Appium test for Issue #34611 and an iOS snapshot baseline.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Core/src/Handlers/Entry/EntryHandler.iOS.cs | Adds iOS/macCatalyst MapBackground to clear background layers and reset native BackgroundColor when background is null/empty. |
| src/Core/src/Handlers/Editor/EditorHandler.iOS.cs | Adds iOS/macCatalyst MapBackground with the same reset behavior for Editor. |
| src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt | Declares the new MapBackground APIs for iOS. |
| src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt | Declares the new MapBackground APIs for MacCatalyst. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue34611.cs | Adds the HostApp repro page for the issue with relevant AutomationIds. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34611.cs | Adds an Appium UI test validating the reset behavior via a screenshot assertion. |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull.png | Adds iOS snapshot baseline for the new screenshot test. |
| [Test] | ||
| [Category(UITestCategories.Entry)] | ||
| public void EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull() | ||
| { | ||
| App.WaitForElement("ApplyBackgroundColorButton"); | ||
| App.Tap("ApplyBackgroundColorButton"); | ||
| App.WaitForElement("TestEntry"); | ||
| App.Tap("ResetToDefaultButton"); | ||
| VerifyScreenshot(); |
There was a problem hiding this comment.
This UI screenshot test will execute in every platform test project that links in TestCases.Shared.Tests, but the PR only adds a baseline snapshot under TestCases.iOS.Tests/snapshots/ios. VerifyScreenshot() will fail on other runners (Android/Windows/macCatalyst) and also on iOS 26 where the environment name switches to ios-26 and expects a baseline under snapshots/ios-26. Either scope the test to iOS+MacCatalyst (e.g., file-level #if IOS || MACCATALYST / Assert.Ignore on other platforms) and add the corresponding mac + ios-26 baselines, or add baselines for all platforms where it will run.
| App.WaitForElement("ApplyBackgroundColorButton"); | ||
| App.Tap("ApplyBackgroundColorButton"); | ||
| App.WaitForElement("TestEntry"); | ||
| App.Tap("ResetToDefaultButton"); | ||
| VerifyScreenshot(); |
There was a problem hiding this comment.
After tapping "ResetToDefaultButton", the visual update may not be fully applied by the time the screenshot is taken, which can make this test flaky. Prefer using VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(...)) (and/or an explicit wait for a stable UI condition) instead of taking the screenshot immediately.
🚦 Gate - Test Before and After Fix📊 Expand Full Gate —
|
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
🖥️ Issue34611 Issue34611 |
✅ FAIL — 204s | ✅ PASS — 85s |
🔴 Without fix — 🖥️ Issue34611: FAIL ✅ · 204s
Determining projects to restore...
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 561 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 699 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 7.68 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/Foldable/src/Controls.Foldable.csproj (in 7.76 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 7.77 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 7.77 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 7.77 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj (in 7.77 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Core/maps/src/Maps.csproj (in 7.79 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj (in 7.79 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/Maps/src/Controls.Maps.csproj (in 7.8 sec).
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-ios26.0/Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-ios26.0/Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-ios26.0/Microsoft.Maui.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Maps.dll
Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-ios26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Maps.dll
Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Xaml.dll
Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Foldable.dll
Detected signing identity:
Code Signing Key: "" (-)
Provisioning Profile: "" () - no entitlements
Bundle Id: com.microsoft.maui.uitests
App Id: com.microsoft.maui.uitests
Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.dll
Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
Optimizing assemblies for size. This process might take a while.
Build succeeded.
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
1 Warning(s)
0 Error(s)
Time Elapsed 00:01:40.44
Determining projects to restore...
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/CustomAttributes/Controls.CustomAttributes.csproj (in 817 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils/VisualTestUtils.csproj (in 817 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 817 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 821 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Core/UITest.Core.csproj (in 817 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 966 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 409 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 1.26 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.NUnit/UITest.NUnit.csproj (in 1.61 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Appium/UITest.Appium.csproj (in 1.78 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj (in 2.71 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils.MagickNet/VisualTestUtils.MagickNet.csproj (in 2.51 sec).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj (in 3.37 sec).
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
Controls.TestCases.iOS.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
/Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.04] Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.13] Discovered: Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 4/2/2026 9:04:48 AM FixtureSetup for Issue34611(iOS)
>>>>> 4/2/2026 9:04:51 AM EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull Start
>>>>> 4/2/2026 9:04:54 AM EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull Stop
>>>>> 4/2/2026 9:04:54 AM Log types: syslog, crashlog, performance, safariConsole, safariNetwork, server
Failed EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull [3 s]
Error Message:
VisualTestUtils.VisualTestFailedException :
Snapshot different than baseline: EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull.png (6.91% difference)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.
More info: https://aka.ms/visual-test-workflow
Stack Trace:
at VisualTestUtils.VisualRegressionTester.Fail(String message) in /_/src/TestUtils/src/VisualTestUtils/VisualRegressionTester.cs:line 162
at VisualTestUtils.VisualRegressionTester.VerifyMatchesSnapshot(String name, ImageSnapshot actualImage, String environmentName, ITestContext testContext) in /_/src/TestUtils/src/VisualTestUtils/VisualRegressionTester.cs:line 123
at Microsoft.Maui.TestCases.Tests.UITest.<VerifyScreenshot>g__Verify|13_0(String name, <>c__DisplayClass13_0&) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 477
at Microsoft.Maui.TestCases.Tests.UITest.VerifyScreenshot(String name, Nullable`1 retryDelay, Nullable`1 retryTimeout, Int32 cropLeft, Int32 cropRight, Int32 cropTop, Int32 cropBottom, Double tolerance) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 309
at Microsoft.Maui.TestCases.Tests.Issues.Issue34611.EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34611.cs:line 23
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
NUnit Adapter 4.5.0.0: Test execution complete
Total tests: 1
Failed: 1
Test Run Failed.
Total time: 59.3314 Seconds
🟢 With fix — 🖥️ Issue34611: PASS ✅ · 85s
Determining projects to restore...
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 581 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 595 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 600 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 647 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 663 ms).
6 of 11 projects are up-to-date for restore.
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-ios26.0/Microsoft.Maui.Graphics.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-ios26.0/Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-ios26.0/Microsoft.Maui.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Maps.dll
Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-ios26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Foldable.dll
Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Maps.dll
Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Xaml.dll
Detected signing identity:
Code Signing Key: "" (-)
Provisioning Profile: "" () - no entitlements
Bundle Id: com.microsoft.maui.uitests
App Id: com.microsoft.maui.uitests
Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.dll
Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
Optimizing assemblies for size. This process might take a while.
Build succeeded.
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
1 Warning(s)
0 Error(s)
Time Elapsed 00:00:43.07
Determining projects to restore...
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 371 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 383 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 387 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 400 ms).
Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 417 ms).
8 of 13 projects are up-to-date for restore.
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
##vso[build.updatebuildnumber]10.0.60-ci+azdo.13725101
Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
Controls.TestCases.iOS.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
/Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.03] Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.12] Discovered: Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 4/2/2026 9:06:15 AM FixtureSetup for Issue34611(iOS)
>>>>> 4/2/2026 9:06:18 AM EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull Start
>>>>> 4/2/2026 9:06:20 AM EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull Stop
Passed EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull [1 s]
NUnit Adapter 4.5.0.0: Test execution complete
Test Run Successful.
Total tests: 1
Passed: 1
Total time: 17.2195 Seconds
📁 Fix files reverted (5 files)
eng/pipelines/ci-copilot.ymlsrc/Core/src/Handlers/Editor/EditorHandler.iOS.cssrc/Core/src/Handlers/Entry/EntryHandler.iOS.cssrc/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txtsrc/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
New files (not reverted):
github-merge-flow-release-11.jsonc
🤖 AI Summary📊 Expand Full Review —
|
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #34741 | Override MapBackground in EntryHandler.iOS.cs and EditorHandler.iOS.cs; handle null/empty by calling RemoveBackgroundLayer() + platformView.BackgroundColor = null |
✅ PASSED (Gate) | EntryHandler.iOS.cs, EditorHandler.iOS.cs, PublicAPI.Unshipped.txt (×2), Issue34611.cs (×2), snapshot |
Original PR |
🔧 Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix (claude-opus-4.6) | Remove restriction entirely in PASS | 1 file (ViewExtensions.cs) |
Simplest; net -2 lines; fixes all view types; no new API | |
| 2 | try-fix (claude-sonnet-4.6) | Extend type guard to in | PASS | 1 file (ViewExtensions.cs) |
Conservative; other UIViews unaffected |
| 3 | try-fix (gpt-5.3-codex) | Add interface on /; called from | PASS | 3 files | Extensible but over-engineered for this bug |
| 4 | try-fix (gpt-5.4) | Extend in + on platform views | PASS | 3 files | Hooks into layer cleanup path; invasive |
| 5 | try-fix (claude-opus-4.6 R2) | Snapshot native at construction; restore via in | PASS | 3 files | Restores true UIKit defaults; no new public API |
- | PASSED (Gate) | 4 files + 2 PublicAPI.Unshipped.txt | Original PR; per-handler; adds 2 public API members |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| claude-opus-4.6 | 2 | No | All 5 approaches cover the design spectrum |
| materialized as Attempt 5 | |||
| incorporated into Attempt 5 | |||
| similar pattern covered by Attempt 4 | |||
| claude-opus-4.6 | 3 | No | Design space exhausted |
Exhausted: Round 3 confirmed no new ideasYes
Selected Fix: Attempt 1 (remove LayoutView restriction in ViewExtensions. root-cause fix, 1 file, no new API, simplest solutioncs)
Best Fix Comparison
| Criteria | Attempt 1 | PR #34741 |
|---|---|---|
| Files changed | 1 | 4 (+2 PublicAPI) |
| Net lines | -2 | ~+50 |
| Public API changes | None | 2 new static MapBackground methods |
| Scope | All UIViews benefit | Entry + Editor only |
| Root cause fixed Workaround (per-handler bypass) | Yes | |
| Test passes |
📋 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | Issue #34611 — iOS/macCatalyst Entry/Editor BackgroundColor null reset |
| Gate | ✅ PASSED | iOS — test FAILED without fix, PASSED with fix |
| Try-Fix | ✅ COMPLETE | 5 attempts, all 5 passing; alternative root-cause fix found |
| Report | ✅ COMPLETE |
Summary
PR #34741 fixes a real, verified bug on iOS/macCatalyst where Entry.BackgroundColor = null and Editor.BackgroundColor = null do not restore native default appearance after a custom color is applied. The fix is correct and the Gate confirms it works. However, Try-Fix exploration discovered a simpler, superior root-cause fix in one file with no new public API surface, and there are also two existing test quality issues flagged by inline review comments.
Root Cause
ViewExtensions.UpdateBackground() (src/Core/src/Platform/iOS/ViewExtensions.cs line ~86) guards the BackgroundColor = null reset behind a platformView is LayoutView type check. MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView subclasses, so the reset silently returns without clearing the color.
Fix Quality
The PR's approach adds platform-specific MapBackground overrides to EntryHandler.iOS.cs and EditorHandler.iOS.cs. These override the base class behavior only for Entry and Editor, calling platformView.BackgroundColor = null + RemoveBackgroundLayer() in the null/empty branch. This works (Gate ✅), but:
- ❌ Adds 2 new public API methods (
EditorHandler.MapBackground,EntryHandler.MapBackground) requiringPublicAPI.Unshipped.txtupdates — unnecessary API surface bloat - ❌ Is a per-handler workaround rather than a root-cause fix — other UIView-based controls with the same issue (e.g.,
Picker,DatePicker,TimePickeron iOS, which are also notLayoutView) remain broken - ❌ Minor code style inconsistency:
EditorHandler.iOS.csis missing the explicitreturnafterFireAndForget(handler)in theImageSourcePaintbranch (EntryHandler has it; EditorHandler doesn't)
Better alternative (Attempt 1 — ✅ PASS): Remove the LayoutView type restriction entirely in ViewExtensions.UpdateBackground():
if (paint.IsNullOrEmpty())
{
- if (platformView is LayoutView)
- platformView.BackgroundColor = null;
- else
- return;
+ platformView.BackgroundColor = null;
+ return;
}This is 1 file changed, -2 net lines, no new public API, and fixes the root cause for ALL UIView subclasses.
Test issues (from inline review comments — not yet addressed by PR):
-
Missing snapshots for other platforms/OS versions:
VerifyScreenshot()will run on Android, Windows, MacCatalyst, and iOS 26 (envios-26) but only an iOS baseline exists underTestCases.iOS.Tests/snapshots/ios/. The test will fail on all other platforms/environments. -
Potential flakiness:
VerifyScreenshot()is called immediately after tapping Reset — the visual update may not have propagated. Should beVerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)).
Requested Changes
-
Replace the handler-level fix with the root-cause fix in
ViewExtensions.UpdateBackground()(remove theLayoutViewguard). This eliminates the need for new public API and fixes the problem more broadly. -
Fix the
VerifyScreenshot()call — addretryTimeout: TimeSpan.FromSeconds(2)to avoid flakiness. -
Scope the test or add missing baselines — either add an
Assert.Ignorefor non-iOS platforms, or add snapshot baselines for macCatalyst, Android, Windows, andios-26. -
(Minor) Add missing
returnafterFireAndForget(handler)inEditorHandler.MapBackground()for consistency withEntryHandler.iOS.cs(only relevant if the handler approach is kept).
Selected Fix: Alternative (Attempt 1 in try-fix)
kubaflo
left a comment
There was a problem hiding this comment.
Could you please review the AI's summary?
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
On iOS and macCatalyst, setting BackgroundColor = null on an Entry or Editor at runtime does not restore the native default appearance. Once a custom color is applied, it persists even after the property is cleared.
Root Cause
The shared iOS background update logic only resets BackgroundColor = null for LayoutView subclasses — all other UIView types silently return. MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView subclasses, so the reset is skipped.
Description of Change
Platform-specific MapBackground methods were added to EntryHandler.iOS.cs and EditorHandler.iOS.cs. When Background.IsNullOrEmpty(), they now explicitly set platformView.BackgroundColor = null to restore native appearance.
Validated the behavior in the following platforms
Issues Fixed
Fixes #34611
Output ScreenShot
34611-BeforeFix.mov
34611-AfterFix.mov