Skip to content

Fix ContentViewRespondsWhenViewRemoved test fails on Catalyst #32481

Merged
StephaneDelcroix merged 5 commits intodotnet:inflight/currentfrom
SuthiYuvaraj:fix-32368
Dec 2, 2025
Merged

Fix ContentViewRespondsWhenViewRemoved test fails on Catalyst #32481
StephaneDelcroix merged 5 commits intodotnet:inflight/currentfrom
SuthiYuvaraj:fix-32368

Conversation

@SuthiYuvaraj
Copy link
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 Description

When content is removed from a ContentView, its height remains cached, leading to layout inconsistencies.

Root Cause

To improve performance, measure caching was introduced in #31485, which reuses previously measured sizes to avoid redundant layout passes. However, when content is removed, the cached size isn’t automatically invalidated. This causes parent layouts to rely on stale measurements. While invalidation was already handled for content updates (#30991), it wasn’t addressed for content removal.

Description of Change

Added InvalidateMeasure calls for both ContentView and its parent when content is set to null and the cached size remains. This ensures proper re-measurement and layout refresh.

Regression PR

PR #31485
PR #30991

Issues Fixed

Fixes #32368

Tested the behaviour on the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before Issue Fix After Issue Fix
Before Fix After Fix

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Nov 10, 2025
@SuthiYuvaraj SuthiYuvaraj changed the title Fix 32368 Fix ContentViewRespondsWhenViewRemoved test fails on Catalyst Nov 11, 2025
@sheiksyedm
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@SuthiYuvaraj SuthiYuvaraj marked this pull request as ready for review November 17, 2025 13:05
Copilot AI review requested due to automatic review settings November 17, 2025 13:05
Copy link
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

This PR fixes a layout caching issue on iOS/Catalyst where ContentView would retain its cached size after its content was removed. The fix adds measure invalidation logic when content is set to null, ensuring the ContentView can properly resize to 0x0.

Key Changes:

  • Added conditional invalidation logic when content is removed from ContentView (checks for non-zero cached bounds before invalidating)
  • Re-enabled the previously skipped ContentViewRespondsWhenViewRemoved test that was failing due to this issue

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Core/src/Handlers/ContentView/ContentViewHandler.iOS.cs Adds an else block to UpdateContent that invalidates measures when content is removed and the ContentView has non-zero cached bounds
src/Controls/tests/DeviceTests/Elements/ContentView/ContentViewTests.iOS.cs Removes the Skip attribute from ContentViewRespondsWhenViewRemoved test, re-enabling it now that the underlying issue is fixed

Copy link
Contributor

@StephaneDelcroix StephaneDelcroix left a comment

Choose a reason for hiding this comment

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

tested on iOS and catalyst

@github-project-automation github-project-automation bot moved this from Todo to Approved in MAUI SDK Ongoing Dec 2, 2025
@StephaneDelcroix StephaneDelcroix changed the base branch from main to inflight/current December 2, 2025 18:42
@StephaneDelcroix StephaneDelcroix merged commit c4fa00a into dotnet:inflight/current Dec 2, 2025
62 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Dec 2, 2025
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
* Update ContentViewHandler.iOS.cs

* condition for null

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
* Update ContentViewHandler.iOS.cs

* condition for null

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
* Update ContentViewHandler.iOS.cs

* condition for null

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
* Update ContentViewHandler.iOS.cs

* condition for null

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
* Update ContentViewHandler.iOS.cs

* condition for null

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs
@karthikraja-arumugam karthikraja-arumugam added the community ✨ Community Contribution label Dec 4, 2025
github-actions bot pushed a commit that referenced this pull request Dec 5, 2025
* Update ContentViewHandler.iOS.cs

* condition for null

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs

* Update ContentViewHandler.iOS.cs
@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug] ContentViewRespondsWhenViewRemoved test fails on Catalyst

6 participants