Make internal types used by MAUI Toolkit public#29443
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR exposes several interfaces previously marked as internal (ICornerElement, ILineHeightElement, ITextAlignmentElement, and ITextElement) so that they can be publicly used by the MAUI Toolkit. The changes include adding new public API declarations across multiple platform-specific PublicAPI.Unshipped.txt files and updating corresponding source files with XML documentation.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt | Added public declarations for new interface members. |
| src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt | Added public declarations for new interface members. |
| src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt | Added public declarations for new interface members. |
| src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt | Added public declarations for new interface members. |
| src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt | Added public declarations for new interface members. |
| src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt | Added public declarations for new interface members. |
| src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt | Added public declarations for new interface members. |
| src/Controls/src/Core/ITextElement.cs | Changed ITextElement to public and added detailed XML documentation. |
| src/Controls/src/Core/ITextAlignmentElement.cs | Changed ITextAlignmentElement to public with extended XML documentation. |
| src/Controls/src/Core/ILineHeightElementInternal.cs | Retained obsolete internal interface for backward compatibility. |
| src/Controls/src/Core/ILineHeightElement.cs | Changed ILineHeightElement to public and improved XML documentation. |
| src/Controls/src/Core/ICornerElement.cs | Changed ICornerElement to public with added XML documentation. |
Comments suppressed due to low confidence (3)
src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt:49
- [nitpick] The use of the '~' prefix for ITextElement methods may be confusing since it is not a common convention for public API members. Consider clarifying the intention or renaming these members to align with other public APIs.
+~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt:26
- Verify that tests in TestCases.HostApp and TestCases.Shared.Tests are updated to cover the new public API members (e.g., ICornerElement, ILineHeightElement, ITextAlignmentElement, and ITextElement) to ensure proper integration and behavior.
+Microsoft.Maui.Controls.ICornerElement
src/Controls/src/Core/ITextElement.cs:13
- Ensure that the public XML documentation in the /docs/ folder is updated to include the newly public ITextElement interface and its members, reflecting the intended behavior and usage.
public interface ITextElement
| using System; | ||
| using System.ComponentModel; | ||
|
|
||
| namespace Microsoft.Maui.Controls.Internals |
There was a problem hiding this comment.
I have duplicated this one. I wanted to get rid of the "Internals" in the namespace, but since we need to provide a transition path, we want to keep the one that is available right now, and provide the new public one in the new namespace.
Once we remove InternalsVisibleTo we can remove this one as well. I will make sure to note that in the issue to track this.
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 of Change
Earlier attempt: #28994 then reverted in: #29321
We still want this change, but we need to take into account the timing. After the first merge, our tests would break and people were not able to use .NET 10 previews with the .NET MAUI Community Toolkit as there is no compatible Toolkit version yet.
Now I'm breaking up this change:
InternalsVisibleToafter we have released .NET 10 and there is a compatible Toolkit version, this can be done in a service release since removingInternalsVisibleTois not a breaking change.Issues Fixed
Fixes #28981