KEMBAR78
Add overrides to Help with Obsoleting Compatibility.Layout by PureWeen · Pull Request #30058 · dotnet/maui · GitHub
Skip to content

Conversation

PureWeen
Copy link
Member

Description of Change

We had a few vendors test out the follow PR #29281 and they reported crashes on OnSizeAllocated.

An unhandled exception of type 'System.MethodAccessException' occurred in Microsoft.MacCatalyst.dll: 'Method `Microsoft.Maui.Controls.Compatibility.Layout.OnSizeAllocated(double,double)' is inaccessible from method

If we add these overrides to the base classes that we are keeping and then 3rd parties recompile, that will better prepare us down the road for hopefully getting to delete Compatibility.Layout

@Copilot Copilot AI review requested due to automatic review settings June 18, 2025 19:08
@PureWeen PureWeen requested a review from a team as a code owner June 18, 2025 19:08
Copy link
Contributor

@Copilot 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 adds protected overrides of OnSizeAllocated to maintain binary compatibility with existing consumers when Compatibility.Layout is removed.

  • Introduces OnSizeAllocated overrides in TemplatedView, ScrollView, and ContentPresenter
  • Updates PublicAPI.Unshipped files to expose the new overrides
  • Ensures future binary compatibility with libraries compiled against MAUI

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

File Description
src/Controls/src/Core/TemplatedView/TemplatedView.cs Added OnSizeAllocated override and compatibility comments
src/Controls/src/Core/ScrollView/ScrollView.cs Added OnSizeAllocated override and compatibility comments
src/Controls/src/Core/ContentPresenter.cs Added OnSizeAllocated override and compatibility comments
src/Controls/src/Core/PublicAPI/*/PublicAPI.Unshipped.txt Exposed the new overrides in all target frameworks' unshipped APIs
Comments suppressed due to low confidence (1)

src/Controls/src/Core/TemplatedView/TemplatedView.cs:146

  • There are no existing tests covering the new OnSizeAllocated override. Please add or update test cases in TestCases.Shared.Tests and TestCases.HostApp to verify this method is invoked correctly.
		protected override void OnSizeAllocated(double width, double height)

@PureWeen PureWeen force-pushed the add_overrides_to_help_with_binary_compat branch from d117d11 to 990cc0b Compare June 23, 2025 19:57
@PureWeen PureWeen added the p/0 Work that we can't release without label Jun 23, 2025
@github-project-automation github-project-automation bot moved this from Todo to Approved in MAUI SDK Ongoing Jun 24, 2025
@PureWeen PureWeen merged commit 36ec8c8 into main Jun 24, 2025
126 of 129 checks passed
@PureWeen PureWeen deleted the add_overrides_to_help_with_binary_compat branch June 24, 2025 12:49
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Jun 24, 2025
NanthiniMahalingam pushed a commit to NanthiniMahalingam/maui that referenced this pull request Jun 27, 2025
)

* Add overrides to Help with Obsoleting Compatibility.Layout

* - fix spelling

* - fix API txt file

* - fix comments

* - tizen
@github-actions github-actions bot locked and limited conversation to collaborators Jul 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

p/0 Work that we can't release without

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants