Skip to content

CompositionSpriteShape.StrokeMiterLimit defaults to 0 instead of 1 #25351

Closed

Description

@MartinZikmund

Current behavior 🐛

A freshly created CompositionSpriteShape reports StrokeMiterLimit == 0 on Uno. The backing field in CompositionSpriteShape has no initializer, so the default is 0f, and that value is passed straight to the Skia stroker (MiterLimit = StrokeMiterLimit in GetStrokeStyle).

Expected behavior 🎯

On WinUI / Windows App SDK a new sprite shape reports StrokeMiterLimit == 1. Microsoft Learn documents the value as "always a positive number that is greater than or equal to 1", so 0 is not a valid state for it.

The other stroke defaults already match (StrokeThickness=1, StrokeDashOffset=0, StrokeDashCap/StartCap/EndCap=Flat, StrokeLineJoin=Miter).

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Create a Uno Skia Desktop app.
  2. Run:
var anchor = new Border { Width = 1, Height = 1 };
Content = anchor;
var compositor = ElementCompositionPreview.GetElementVisual(anchor).Compositor;
var shape = compositor.CreateSpriteShape();
Debug.WriteLine(shape.StrokeMiterLimit); // WinUI: 1, Uno: 0

Verified with this runtime test on Skia Desktop (net11.0-desktop), which fails with Expected:<1>. Actual:<0>:

[TestMethod]
[RunsOnUIThread]
public async Task When_Default_StrokeMiterLimit()
{
	var anchor = new Border { Width = 1, Height = 1 };
	await UITestHelper.Load(anchor);
	var compositor = ElementCompositionPreview.GetElementVisual(anchor).Compositor;
	var shape = compositor.CreateSpriteShape();
	Assert.AreEqual(1f, shape.StrokeMiterLimit);
}

I did not check the rendered difference for a sharp-angle Miter join. The impact is expected from the value reaching the stroker, but that is not proven here.

Workaround 🛠️

Set shape.StrokeMiterLimit = 1f (or the value you want) explicitly.

Works on UWP/WinUI

Yes. The WinUI value comes from a runtime probe of compositor.CreateSpriteShape() on Windows App SDK 2.4 (StrokeMiterLimit=1). The Learn page for the property gives the >= 1 range but no explicit default, so the probe is the evidence for the default.

Affected platforms 📱💻🖥️

All platforms 🌍 (the property lives in the shared CompositionSpriteShape).

Uno.Sdk version (and other relevant versions) 📦

master at 0599dad (net11.0-desktop).

IDE version 🧑‍💻

N/A

Anything else we need to know? 💬

Root cause: the field has no initializer, unlike _strokeThickness, which defaults to 1.0f right above it.

Suggested fix: private float _strokeMiterLimit = 1.0f;, plus a runtime test like the one above. It should also be checked that the stroker treats a limit of 1 like WinUI for sharp-angle miter joins.

Related: the composition stroke default fixes in #25199, #25200 and #25202. #25202 notes the miter limit as a separate gap and does not change the default.

Activity

  1. added
    kind/bug
    good first issue
    triage/untriaged
    project/shapes-brushes 🔶
    platform/all
    difficulty/starter 🚀
    area/composition
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/compositionarea/skia/composition ✏️difficulty/starter 🚀good first issuekind/bugplatform/allproject/shapes-brushes 🔶triage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions