How to persist an Avalonia Geometry object?

Viewed 99

I'm getting an error trying to serialize an Avalonia.Media.Geometry object with Json.Net.

RectangleGeometry geometry = new RectangleGeometry(new Rect(32, 32, 32, 32));
string json = JsonConvert.SerializeObject(geometry);

gives
Self referencing loop detected for property 'Standardized' with type 'SkiaSharp.SKRect'. Path 'PlatformImpl.EffectivePath.Bounds'.

In WPF one can use string x = XamlWriter.Save(geometry);, but in Avalonia I can only find AvaloniaXamlLoader.

Does Avalonia have a WPF XamlWriter equivilent? Or perhaps some other method to persist a Geometry?

0 Answers
Related