Remove InternalsVisibleTo attributes for .NET MAUI Community Toolkit#34070
Remove InternalsVisibleTo attributes for .NET MAUI Community Toolkit#34070jfversluis wants to merge 1 commit intonet11.0from
Conversation
Remove all InternalsVisibleTo attributes that grant the .NET MAUI Community Toolkit access to internal APIs across 4 assembly files: - src/Controls/src/Core/Properties/AssemblyInfo.cs (6 entries) - src/Controls/src/Xaml/Properties/AssemblyInfo.cs (6 entries) - src/Essentials/src/AssemblyInfo/AssemblyInfo.shared.cs (5 entries) - src/Core/src/Properties/AssemblyInfo.cs (5 entries) Total: 22 InternalsVisibleTo declarations removed for: - CommunityToolkit.Maui - CommunityToolkit.Maui.Core - CommunityToolkit.Maui.Embedding - CommunityToolkit.Maui.UnitTests - CommunityToolkit.Maui.Markup - CommunityToolkit.Maui.Markup.UnitTests Also removed a pre-existing duplicate Controls.TestCases.HostApp entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR removes all InternalsVisibleTo attributes that grant the .NET MAUI Community Toolkit access to internal APIs. This is the third attempt to make this change, now targeting the net11.0 branch to provide the toolkit team sufficient time to migrate away from internal API dependencies.
Changes:
- Removed 22
InternalsVisibleTodeclarations across 4 AssemblyInfo files for CommunityToolkit assemblies - Removed duplicate
Controls.TestCases.HostAppentry from Controls/Core AssemblyInfo - Preserved all other InternalsVisibleTo entries for MAUI's own test and compatibility assemblies
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Essentials/src/AssemblyInfo/AssemblyInfo.shared.cs | Removed 5 CommunityToolkit InternalsVisibleTo entries |
| src/Core/src/Properties/AssemblyInfo.cs | Removed 5 CommunityToolkit InternalsVisibleTo entries |
| src/Controls/src/Xaml/Properties/AssemblyInfo.cs | Removed 6 CommunityToolkit InternalsVisibleTo entries |
| src/Controls/src/Core/Properties/AssemblyInfo.cs | Removed 6 CommunityToolkit entries + 1 duplicate Controls.TestCases.HostApp entry |
| [assembly: InternalsVisibleTo("CommunityToolkit.Maui.Markup.UnitTests")] | ||
| [assembly: InternalsVisibleTo("Controls.TestCases.HostApp")] | ||
|
|
||
| [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] |
There was a problem hiding this comment.
According to issue #29444, the file src/Controls/src/Core/ILineHeightElementInternal.cs should be deleted as part of removing InternalsVisibleTo attributes. This file was only kept to provide a transition path for the toolkit and is now obsolete. The interface has been replaced by Microsoft.Maui.Controls.ILineHeightElement and is no longer used within the MAUI codebase.
|
Moving this to draft, the Toolkit team can get the resulting artifacts from this for testing to make sure that all APIs are replaced. |
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
Removes all
InternalsVisibleToattributes that grant the .NET MAUI Community Toolkit access to internal APIs. This is the same change as #33442 (which was reverted in #34047 for .NET 10 SR4), now targeting net11.0 to give the toolkit team time to migrate.Previous attempts:
ITextElement,ICornerElement, etc.)Files Modified
src/Controls/src/Core/Properties/AssemblyInfo.csControls.TestCases.HostAppsrc/Controls/src/Xaml/Properties/AssemblyInfo.cssrc/Essentials/src/AssemblyInfo/AssemblyInfo.shared.cssrc/Core/src/Properties/AssemblyInfo.csTotal: 22
InternalsVisibleTodeclarations removed forCommunityToolkit.Maui,.Core,.Embedding,.UnitTests,.Markup,.Markup.UnitTests.Internal APIs Still Used by the Toolkit
Can be fixed on the toolkit side (public alternatives exist):
InvalidateMeasureInternal(InvalidationTrigger)InvalidateMeasure()XamlParseException(string, IServiceProvider)IXmlLineInfoGetDefaultFontSize()IFontManager.DefaultFontSizefrom servicesRequireFontManager()IFontManagerfromMauiContext.ServicesAppThemeBindingGetTargetOrDefault()Requires MAUI to provide public alternatives:
FontElement(static class)TextElement(static class)ImageElement(static class)IResourcesProvider(interface)ImageSource.CancellationTokenSourceprotectedStreamWrapperIssues Fixed
Context: #29444, #34048
cc @TheCodeTraveler