-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mark OffscreenPageLimitProperty as obsolete and remove unused code #31306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark OffscreenPageLimitProperty as obsolete and remove unused code #31306
Conversation
Co-authored-by: PureWeen <[email protected]>
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this 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]>
|
/asp run |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
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
OffscreenPageLimitPropertyand 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 inMicrosoft.Maui.Controls.PlatformConfiguration.AndroidSpecific.TabbedPage:OffscreenPageLimitProperty- The BindableProperty definitionGetOffscreenPageLimit(BindableObject)- Static getter methodSetOffscreenPageLimit(BindableObject, int)- Static setter methodOffscreenPageLimit(IPlatformElementConfiguration<Android, FormsElement>)- Extension methodSetOffscreenPageLimit(IPlatformElementConfiguration<Android, FormsElement>, int)- Extension setter methodImplementation Updates
#pragma warning disable CS0618around existing usage sites to suppress obsolete warnings in internal implementation code:TabbedPageRenderer.UpdateOffscreenPageLimit()(Compatibility layer)UpdateOffscreenPageLimit()method fromTabbedPageManager.cssince no code was calling itUpdateOffscreenPageLimit()method inTabbedPageRenderer.cs(compatibility layer) where it is actually usedCode Cleanup
The unused
UpdateOffscreenPageLimit()method in the modernTabbedPageManagerimplementation was removed as it was never called, while preserving the same method in the compatibility layer where it's properly utilized.Impact
Testing
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.