Background
In Xamarin.AndroidX.Compose.Material3Android (verified against
1.4.0.3), the ShapesKt companion class only exposes the
LocalShapes CompositionLocal accessor — the public
Shapes(small, medium, large, extraSmall, extraLarge) builder
function is missing entirely:
// AndroidX.Compose.Material3.ShapesKt (full method list)
get_class_ref() -> IntPtr
get_JniPeerMembers() -> JniPeerMembers
get_ThresholdClass() -> IntPtr
get_ThresholdType() -> Type
get_LocalShapes() -> ProvidableCompositionLocal
.ctor(IntPtr, JniHandleOwnership) -> Void
.cctor() -> Void
// ^ no Shapes(...) builder
Upstream Kotlin (androidx.compose.material3.ShapesKt):
fun Shapes(
extraSmall: CornerBasedShape = ShapeDefaults.ExtraSmall,
small: CornerBasedShape = ShapeDefaults.Small,
medium: CornerBasedShape = ShapeDefaults.Medium,
large: CornerBasedShape = ShapeDefaults.Large,
extraLarge: CornerBasedShape = ShapeDefaults.ExtraLarge,
): Shapes
Notably none of the parameters are inline-class types — they're
all reference types (CornerBasedShape). So this is not the same
JVM-mangling story as Text--4IGK_g / Button-bWB7cM8 /
lightColorScheme(-...) from
dotnet/java-interop#1440. This looks like a real binder
bug or an overly broad <remove-node> rule in
material3-android/Transforms/Metadata.xml.
The same package does expose:
MaterialThemeKt.MaterialTheme(ColorScheme, Shapes, Typography, …)
ColorSchemeKt.LightColorScheme(Int64×47) /
DarkColorScheme(Int64×47)
MaterialTheme.GetShapes(IComposer, Int32) companion accessor
new Shapes() parameterless ctor (so callers can take the
Compose default)
— so the type Shapes is fully bound and consumable; only the
factory function that lets you build a customized Shapes with
the standard defaults is missing. This blocks
jonathanpeppers/compose-net#61 (parameterizing
MaterialTheme).
Ask
Find and remove the <remove-node> (or equivalent
<remove-method>) in material3-android/Transforms/Metadata.xml
that's stripping the Shapes(...) static builder out of
ShapesKt, then bump nugetVersion on
Xamarin.AndroidX.Compose.Material3Android.
If the strip is intentional because of a related binder issue
(e.g. CornerBasedShape not yet being resolvable at the right
binding-pipeline stage), please flag that as the underlying root
cause so we can track it separately.
Verification
After the fix, this should compile:
using AndroidX.Compose.Material3;
using AndroidX.Compose.Foundation.Shape;
Shapes shapes = ShapesKt.Shapes(
extraSmall: RoundedCornerShapeKt.RoundedCornerShape(2),
small: RoundedCornerShapeKt.RoundedCornerShape(4),
medium: RoundedCornerShapeKt.RoundedCornerShape(8),
large: RoundedCornerShapeKt.RoundedCornerShape(12),
extraLarge: RoundedCornerShapeKt.RoundedCornerShape(16));
Background
In
Xamarin.AndroidX.Compose.Material3Android(verified against1.4.0.3), theShapesKtcompanion class only exposes theLocalShapesCompositionLocal accessor — the publicShapes(small, medium, large, extraSmall, extraLarge)builderfunction is missing entirely:
Upstream Kotlin (
androidx.compose.material3.ShapesKt):Notably none of the parameters are inline-class types — they're
all reference types (
CornerBasedShape). So this is not the sameJVM-mangling story as
Text--4IGK_g/Button-bWB7cM8/lightColorScheme(-...)fromdotnet/java-interop#1440. This looks like a real binder
bug or an overly broad
<remove-node>rule inmaterial3-android/Transforms/Metadata.xml.The same package does expose:
MaterialThemeKt.MaterialTheme(ColorScheme, Shapes, Typography, …)ColorSchemeKt.LightColorScheme(Int64×47)/DarkColorScheme(Int64×47)MaterialTheme.GetShapes(IComposer, Int32)companion accessornew Shapes()parameterless ctor (so callers can take theCompose default)
— so the type
Shapesis fully bound and consumable; only thefactory function that lets you build a customized
Shapeswiththe standard defaults is missing. This blocks
jonathanpeppers/compose-net#61 (parameterizing
MaterialTheme).Ask
Find and remove the
<remove-node>(or equivalent<remove-method>) inmaterial3-android/Transforms/Metadata.xmlthat's stripping the
Shapes(...)static builder out ofShapesKt, then bumpnugetVersiononXamarin.AndroidX.Compose.Material3Android.If the strip is intentional because of a related binder issue
(e.g.
CornerBasedShapenot yet being resolvable at the rightbinding-pipeline stage), please flag that as the underlying root
cause so we can track it separately.
Verification
After the fix, this should compile: