Summary
In .NET 11, InternalsVisibleTo for the .NET MAUI Community Toolkit will be removed from all MAUI assemblies (see dotnet/maui#34070).
This was attempted twice before for .NET 10 (dotnet/maui#28994, dotnet/maui#33442) but had to be reverted both times because the toolkit hadn't migrated off internal APIs yet.
This issue tracks the toolkit-side work needed to complete the migration.
Internal APIs That Can Be Fixed Now (Public Alternatives Exist)
These can be addressed on the toolkit side without any MAUI changes:
| API |
Toolkit Usage |
Migration Path |
InvalidateMeasureInternal(InvalidationTrigger) |
AvatarView.shared.cs (2 call sites) |
Replace with public InvalidateMeasure() |
XamlParseException(string, IServiceProvider) |
AppThemeResourceExtension.shared.cs (5 call sites) |
Switch to public ctor XamlParseException(string, IXmlLineInfo) |
GetDefaultFontSize() |
AvatarView.shared.cs (1 call site) |
Resolve IFontManager.DefaultFontSize from Handler.MauiContext.Services |
RequireFontManager() |
Snackbar.android.cs, UIFontExtensions.macios.cs |
Resolve IFontManager from MauiContext.Services.GetRequiredService<IFontManager>() |
AppThemeBinding |
AppThemeObject.shared.cs (1 call site) |
Already public on net11.0 — no change needed |
GetTargetOrDefault() |
Snackbar.shared.cs |
Already self-solved — toolkit has own copy in WeakReferenceExtensions.cs |
Internal APIs That Require MAUI to Provide Public Alternatives
These are blocked until MAUI makes them public (tracked in dotnet/maui#34070):
| API |
Toolkit Usage |
Affected Controls |
FontElement (static class) |
FontAttributesProperty, FontAutoScalingEnabledProperty, FontFamilyProperty, FontSizeProperty |
AvatarView |
TextElement (static class) |
TextColorProperty, TextTransformProperty, CharacterSpacingProperty |
AvatarView |
ImageElement (static class) |
SourceProperty, AspectProperty |
AvatarView, TouchBehavior, ImageTouchBehavior |
IResourcesProvider (interface) |
Pattern match on IsResourcesCreated |
AppThemeResourceExtension |
ImageSource.CancellationTokenSource |
private protected property access |
GravatarImageSource |
StreamWrapper |
StreamWrapper.GetStreamAsync() |
HttpClientExtensions (used by GravatarImageSource) |
Affected Toolkit Controls/Features
| Control |
Internal APIs Used |
Can Fix Now? |
| AvatarView |
FontElement, TextElement, ImageElement, GetDefaultFontSize(), InvalidateMeasureInternal() |
Partially |
| AppThemeObject |
AppThemeBinding |
✅ Yes (public in .NET 11) |
| AppThemeResourceExtension |
IResourcesProvider, XamlParseException internal ctor |
Partially |
| GravatarImageSource |
ImageSource.CancellationTokenSource, StreamWrapper |
❌ Blocked on MAUI |
| Snackbar |
RequireFontManager() |
✅ Yes |
| TouchBehavior / ImageTouchBehavior |
ImageElement |
❌ Blocked on MAUI |
| UIFont extensions |
RequireFontManager() |
✅ Yes |
Suggested Approach
- Immediately: Migrate the 6 APIs that have public alternatives (listed above)
- When MAUI provides public types: Migrate
FontElement, TextElement, ImageElement, IResourcesProvider, ImageSource.CancellationTokenSource, StreamWrapper
- For
StreamWrapper: Consider rewriting HttpClientExtensions to use HttpClient directly instead of depending on MAUI's internal wrapper
Related Issues & PRs
cc @TheCodeTraveler @jfversluis
Summary
In .NET 11,
InternalsVisibleTofor the .NET MAUI Community Toolkit will be removed from all MAUI assemblies (see dotnet/maui#34070).This was attempted twice before for .NET 10 (dotnet/maui#28994, dotnet/maui#33442) but had to be reverted both times because the toolkit hadn't migrated off internal APIs yet.
This issue tracks the toolkit-side work needed to complete the migration.
Internal APIs That Can Be Fixed Now (Public Alternatives Exist)
These can be addressed on the toolkit side without any MAUI changes:
InvalidateMeasureInternal(InvalidationTrigger)AvatarView.shared.cs(2 call sites)InvalidateMeasure()XamlParseException(string, IServiceProvider)AppThemeResourceExtension.shared.cs(5 call sites)XamlParseException(string, IXmlLineInfo)GetDefaultFontSize()AvatarView.shared.cs(1 call site)IFontManager.DefaultFontSizefromHandler.MauiContext.ServicesRequireFontManager()Snackbar.android.cs,UIFontExtensions.macios.csIFontManagerfromMauiContext.Services.GetRequiredService<IFontManager>()AppThemeBindingAppThemeObject.shared.cs(1 call site)GetTargetOrDefault()Snackbar.shared.csWeakReferenceExtensions.csInternal APIs That Require MAUI to Provide Public Alternatives
These are blocked until MAUI makes them public (tracked in dotnet/maui#34070):
FontElement(static class)FontAttributesProperty,FontAutoScalingEnabledProperty,FontFamilyProperty,FontSizePropertyTextElement(static class)TextColorProperty,TextTransformProperty,CharacterSpacingPropertyImageElement(static class)SourceProperty,AspectPropertyIResourcesProvider(interface)IsResourcesCreatedImageSource.CancellationTokenSourceprivate protectedproperty accessStreamWrapperStreamWrapper.GetStreamAsync()Affected Toolkit Controls/Features
FontElement,TextElement,ImageElement,GetDefaultFontSize(),InvalidateMeasureInternal()AppThemeBindingIResourcesProvider,XamlParseExceptioninternal ctorImageSource.CancellationTokenSource,StreamWrapperRequireFontManager()ImageElementRequireFontManager()Suggested Approach
FontElement,TextElement,ImageElement,IResourcesProvider,ImageSource.CancellationTokenSource,StreamWrapperStreamWrapper: Consider rewritingHttpClientExtensionsto useHttpClientdirectly instead of depending on MAUI's internal wrapperRelated Issues & PRs
cc @TheCodeTraveler @jfversluis