Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 23, 2025

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!

Description

This PR marks the OffscreenPageLimitProperty and all related methods as obsolete throughout the .NET MAUI codebase to indicate that these APIs are deprecated and should not be used in future development. Additionally, it removes unused code that was identified during the review process.

Changes

API Deprecation

Applied [System.Obsolete] attributes to the following APIs in Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific.TabbedPage:

  • OffscreenPageLimitProperty - The BindableProperty definition
  • GetOffscreenPageLimit(BindableObject) - Static getter method
  • SetOffscreenPageLimit(BindableObject, int) - Static setter method
  • OffscreenPageLimit(IPlatformElementConfiguration<Android, FormsElement>) - Extension method
  • SetOffscreenPageLimit(IPlatformElementConfiguration<Android, FormsElement>, int) - Extension setter method

Implementation Updates

  • Added #pragma warning disable CS0618 around existing usage sites to suppress obsolete warnings in internal implementation code:
    • TabbedPageRenderer.UpdateOffscreenPageLimit() (Compatibility layer)
  • Removed unused code: Deleted the UpdateOffscreenPageLimit() method from TabbedPageManager.cs since no code was calling it
  • Preserved the UpdateOffscreenPageLimit() method in TabbedPageRenderer.cs (compatibility layer) where it is actually used

Code Cleanup

The unused UpdateOffscreenPageLimit() method in the modern TabbedPageManager implementation was removed as it was never called, while preserving the same method in the compatibility layer where it's properly utilized.

Impact

  • Backward Compatibility: All existing code continues to work unchanged
  • Developer Guidance: Developers using these APIs will now receive compiler warnings indicating deprecation
  • Internal Implementation: Framework internals continue to function with appropriate warning suppression
  • Code Quality: Removed dead code that was not being used
  • Future Direction: Signals to developers that these APIs may be removed in future versions

Testing

  • All existing TabbedPage unit tests continue to pass
  • Core.Controls and Compatibility projects build successfully
  • No breaking changes to public API surface beyond the addition of obsolete attributes

This change follows the established pattern for deprecating APIs in the .NET MAUI codebase and provides clear guidance to developers about the future direction of these APIs.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Mark OffscreenPageLimitProperty as obsolete Mark OffscreenPageLimitProperty as obsolete throughout the codebase Aug 23, 2025
Copilot AI requested a review from PureWeen August 23, 2025 01:33
@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen marked this pull request as ready for review August 23, 2025 03:54
Copilot AI review requested due to automatic review settings August 23, 2025 03:54
@PureWeen PureWeen requested a review from a team as a code owner August 23, 2025 03:54
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 marks the OffscreenPageLimitProperty and related APIs as obsolete throughout the .NET MAUI codebase to signal deprecation without breaking existing functionality. The change provides clear guidance to developers that these APIs are deprecated while maintaining backward compatibility.

Key Changes

  • Applied [System.Obsolete] attributes to five APIs in the AndroidSpecific TabbedPage configuration
  • Added pragma warning suppressions around internal usage sites to maintain clean builds
  • Preserved all existing functionality while signaling future removal

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Controls/src/Core/PlatformConfiguration/AndroidSpecific/TabbedPage.cs Added obsolete attributes to OffscreenPageLimit APIs
src/Controls/src/Core/Platform/Android/TabbedPageManager.cs Added pragma warning suppression around obsolete API usage
src/Compatibility/Core/src/Android/AppCompat/TabbedPageRenderer.cs Added pragma warning suppression around obsolete API usage

The UpdateOffscreenPageLimit method in TabbedPageManager.cs was unused - no code called it within this class. The method is still preserved in the Compatibility layer (TabbedPageRenderer.cs) where it is actually used.

Co-authored-by: PureWeen <[email protected]>
Copilot AI changed the title Mark OffscreenPageLimitProperty as obsolete throughout the codebase Mark OffscreenPageLimitProperty as obsolete and remove unused code Aug 23, 2025
Copilot AI requested a review from PureWeen August 23, 2025 20:37
@PureWeen
Copy link
Member

/asp run

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@github-project-automation github-project-automation bot moved this from Todo to Approved in MAUI SDK Ongoing Aug 28, 2025
@dotnet dotnet deleted a comment from dotnet-policy-service bot Aug 28, 2025
@jfversluis jfversluis enabled auto-merge August 28, 2025 13:24
@jfversluis jfversluis merged commit 337728d into net10.0 Aug 28, 2025
148 checks passed
@jfversluis jfversluis deleted the copilot/fix-16431383-282b-4046-a701-b28801123d18 branch August 28, 2025 13:30
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Aug 28, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants