You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shape.PathForBounds is no longer called for a custom Shape #40129
public class CustomShape : Shape, IShape
{
public override PathF GetPath()
{
...
}
public PathF PathForBounds(Rect bounds)
{
...
}
// IShapeWithStroke is internal
//PathF IShapeWithStroke.PathForBounds(Graphics.Rect viewBounds, bool includeStroke)
//{
//}
}
IShapeWithStroke.PathForBounds is now called as a priority. However, since IShapeWithStroke.PathForBounds is internal, a custom Shape cannot implement it; consequently, IShape.PathForBounds is now always ignored for custom Shapes.
This issue has been validated in Visual Studio Code 1.144.1 with .NET MAUI versions 10.0.120 and 10.0.130. It can be reproduced on the Android and iOS platform from 10.0.130 version
@mypp74 For applications staying on .NET MAUI 10.0.130, I suggest the following app-level workaround for the supplied FieldShape used as Border.StrokeShape.
The regression occurs because the renderer now prefers the internal IShapeWithStroke interface inherited from Shape, bypassing the custom IShape.PathForBounds implementation. A small Border adapter can expose only IShape to the renderer and forward the bounds directly to the existing custom implementation.
Workaround
Keep the original FieldShape.cs unchanged. Add this class in the same namespace as FieldShape (FieldShapeIssue in the full reproduction; adjust the namespace for your application):
usingMicrosoft.Maui;usingMicrosoft.Maui.Controls;usingMicrosoft.Maui.Graphics;namespaceFieldShapeIssue;publicsealedclassFieldShapeBorder:Border,IBorderStroke{privateFieldShape?_source;privateIShape?_adapter;IShape?IBorderStroke.Shape{get{if(StrokeShapeis not FieldShapesource){_source=null;_adapter=null;returnStrokeShape;}if(!ReferenceEquals(_source,source)){_source=source;_adapter=newDirectShape(source);}return_adapter;}}// Expose only IShape to the renderer, preserving FieldShape's bounds implementation.privatesealedclassDirectShape:IShape{privatereadonlyIShape_source;publicDirectShape(IShapesource)=>_source=source;publicPathFPathForBounds(Rectbounds)=>_source.PathForBounds(bounds);}}
Replace only the affected <Border> element with <local:FieldShapeBorder>, keeping the existing shape resource, properties, and content:
Use the existing xmlns:local mapping for the namespace containing these classes. No MAUI package changes, reflection, or global handler modifications are needed.
Verification
I reproduced the issue with the supplied sample on Android and iOS simulators using MAUI 10.0.130. With this adapter, the rounded outline, label gap, and Entry are restored. The rendered application content matches the original 10.0.120 baseline pixel-for-pixel on both platforms, excluding system bars.
I also compared 7,680 path cases against 10.0.120, including different sizes, label settings, stroke widths, zero Border stroke, and arranged/unarranged shapes. The path operations and coordinates match exactly. Binding-context inheritance, property-change notifications, shape replacement/removal, and built-in shape pass-through were also checked.
Scope and limitations
This workaround targets the reported Border.StrokeShape usage. It does not address standalone Shape rendering or unrelated Clip usage.
The original FieldShape remains the Border's logical child, so its existing bindings, notifications, and Shape-specific zero-stroke handling are retained. Other Borders are not changed.
I found no visual differences in the tested scenarios, but this is not a blanket guarantee for every application. The adapter cannot implement MAUI's internal shape-version optimization, so additional path recalculations are possible.
Activity
NafeelaNazhir commentedon Nov 10, 2026
This issue has been validated in Visual Studio Code 1.144.1 with .NET MAUI versions 10.0.120 and 10.0.130. It can be reproduced on the Android and iOS platform from 10.0.130 version
FieldShapeIssue.zip
sheiksyedm commentedon Nov 10, 2026
@mypp74 For applications staying on .NET MAUI 10.0.130, I suggest the following app-level workaround for the supplied
FieldShapeused asBorder.StrokeShape.The regression occurs because the renderer now prefers the internal
IShapeWithStrokeinterface inherited fromShape, bypassing the customIShape.PathForBoundsimplementation. A small Border adapter can expose onlyIShapeto the renderer and forward the bounds directly to the existing custom implementation.Workaround
Keep the original
FieldShape.csunchanged. Add this class in the same namespace asFieldShape(FieldShapeIssuein the full reproduction; adjust the namespace for your application):Replace only the affected
<Border>element with<local:FieldShapeBorder>, keeping the existing shape resource, properties, and content:Use the existing
xmlns:localmapping for the namespace containing these classes. No MAUI package changes, reflection, or global handler modifications are needed.Verification
I reproduced the issue with the supplied sample on Android and iOS simulators using MAUI 10.0.130. With this adapter, the rounded outline, label gap, and Entry are restored. The rendered application content matches the original 10.0.120 baseline pixel-for-pixel on both platforms, excluding system bars.
I also compared 7,680 path cases against 10.0.120, including different sizes, label settings, stroke widths, zero Border stroke, and arranged/unarranged shapes. The path operations and coordinates match exactly. Binding-context inheritance, property-change notifications, shape replacement/removal, and built-in shape pass-through were also checked.
Scope and limitations
Border.StrokeShapeusage. It does not address standalone Shape rendering or unrelated Clip usage.FieldShaperemains the Border's logical child, so its existing bindings, notifications, and Shape-specific zero-stroke handling are retained. Other Borders are not changed.Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
[release/10.0.1xx-sr14] Prepare .NET 10 SR14 (10.0.140) with regressi…
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)
Fix custom Shape.PathForBounds dispatch regression (#40132)