Skip to content

[iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set to null#34741

Open
Shalini-Ashokan wants to merge 7 commits intodotnet:mainfrom
Shalini-Ashokan:fix-34611
Open

[iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set to null#34741
Shalini-Ashokan wants to merge 7 commits intodotnet:mainfrom
Shalini-Ashokan:fix-34611

Conversation

@Shalini-Ashokan
Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details

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

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #34611

Output ScreenShot

Before After
34611-BeforeFix.mov
34611-AfterFix.mov

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 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://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34741

Or

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

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 30, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Mar 30, 2026
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 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.MapBackground and EditorHandler.MapBackground to properly handle Background.IsNullOrEmpty() resets.
  • Update PublicAPI.Unshipped.txt for net-ios and net-maccatalyst to 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.

Comment on lines +15 to +23
[Test]
[Category(UITestCategories.Entry)]
public void EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull()
{
App.WaitForElement("ApplyBackgroundColorButton");
App.Tap("ApplyBackgroundColorButton");
App.WaitForElement("TestEntry");
App.Tap("ResetToDefaultButton");
VerifyScreenshot();
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +23
App.WaitForElement("ApplyBackgroundColorButton");
App.Tap("ApplyBackgroundColorButton");
App.WaitForElement("TestEntry");
App.Tap("ResetToDefaultButton");
VerifyScreenshot();
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Apr 2, 2026

🚦 Gate - Test Before and After Fix

📊 Expand Full Gate3264dac · Modified the test

Gate Result: ✅ PASSED

Platform: IOS · Base: main · Merge base: 720a9d4a

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.yml
  • src/Core/src/Handlers/Editor/EditorHandler.iOS.cs
  • src/Core/src/Handlers/Entry/EntryHandler.iOS.cs
  • src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt
  • src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt

New files (not reverted):

  • github-merge-flow-release-11.jsonc

@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Apr 2, 2026

🤖 AI Summary

📊 Expand Full Review3264dac · Modified the test
🔍 Pre-Flight — Context & Validation

Issue: #34611 - [iOS, Maccatalyst] Entry & Editor BackgroundColor not reset to Null
PR: #34741 - [iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set to null
Platforms Affected: iOS, macCatalyst
Files Changed: 4 implementation, 3 test (including 1 snapshot)

Key Findings

  • Root Cause: ViewExtensions.UpdateBackground() only resets BackgroundColor = null for LayoutView subclasses (line 86-87 in ViewExtensions.cs). MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView subclasses, so the null reset path is silently skipped.
  • Fix approach: Add platform-specific MapBackground overrides to EntryHandler.iOS.cs and EditorHandler.iOS.cs that handle the null/empty case by explicitly setting platformView.BackgroundColor = null and calling RemoveBackgroundLayer().
  • Background is already in EntryHandler's Mapper ([nameof(IEntry.Background)] = MapBackground), so overriding MapBackground on iOS naturally routes all background updates through the new handler logic without mapper changes.
  • Inline review comment [Draft] Readme WIP #1 (copilot-pull-request-reviewer): The VerifyScreenshot() test will run on all platforms but only has an iOS baseline snapshot. Will fail on Android, Windows, MacCatalyst, and on iOS 26 (different env name ios-26). Needs platform scoping or additional baselines.
  • Inline review comment Update README.md #2 (copilot-pull-request-reviewer): VerifyScreenshot() is called immediately after tapping Reset — may be flaky if the visual update hasn't propagated yet. Should use VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)).
  • PublicAPI.Unshipped.txt correctly updated for both net-ios and net-maccatalyst with the two new public static MapBackground methods.
  • The EditorHandler fix has a slight structural inconsistency vs EntryHandler: the ImageSourcePaint branch in EditorHandler is missing an explicit return after FireAndForget(), while EntryHandler has it. Functionally identical (no other branch can run), but inconsistent style.

Fix Candidates

# 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) requiring PublicAPI.Unshipped.txt updates — 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, TimePicker on iOS, which are also not LayoutView) remain broken
  • ❌ Minor code style inconsistency: EditorHandler.iOS.cs is missing the explicit return after FireAndForget(handler) in the ImageSourcePaint branch (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):

  1. Missing snapshots for other platforms/OS versions: VerifyScreenshot() will run on Android, Windows, MacCatalyst, and iOS 26 (env ios-26) but only an iOS baseline exists under TestCases.iOS.Tests/snapshots/ios/. The test will fail on all other platforms/environments.

  2. Potential flakiness: VerifyScreenshot() is called immediately after tapping Reset — the visual update may not have propagated. Should be VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)).

Requested Changes

  1. Replace the handler-level fix with the root-cause fix in ViewExtensions.UpdateBackground() (remove the LayoutView guard). This eliminates the need for new public API and fixes the problem more broadly.

  2. Fix the VerifyScreenshot() call — add retryTimeout: TimeSpan.FromSeconds(2) to avoid flakiness.

  3. Scope the test or add missing baselines — either add an Assert.Ignore for non-iOS platforms, or add snapshot baselines for macCatalyst, Android, Windows, and ios-26.

  4. (Minor) Add missing return after FireAndForget(handler) in EditorHandler.MapBackground() for consistency with EntryHandler.iOS.cs (only relevant if the handler approach is kept).

Selected Fix: Alternative (Attempt 1 in try-fix)


@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Apr 2, 2026
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.

Could you please review the AI's summary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-editor Editor area-controls-entry Entry community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios s/agent-changes-requested AI agent recommends changes - found a better alternative or issues 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, Maccatalyst] Entry & Editor BackgroundColor not reset to Null

6 participants