-
Notifications
You must be signed in to change notification settings - Fork 486
Open
Description
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 rewritingHttpClientExtensionsto useHttpClientdirectly instead of depending on MAUI's internal wrapper
Related Issues & PRs
- dotnet/maui#34070 — Remove IVT for .NET 11
- dotnet/maui#34048 — Original breakage report
- dotnet/maui#29444 — Tracking issue for IVT removal
- dotnet/maui#29443 — First batch of types made public
- [NET10] Switch to public MAUI types for AvatarView #2646 — Previous tracking issue (closed)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels