SkiaSharp: SKCanvas.DrawTextOnPath v2.80.1 iOS NullReferenceException
Description
I just updated from 1.68.0 to 2.80.1 and found SKCanvas.DrawTextOnPath crashes with a NullReferenceException
Code
Expected Behavior
Text is rendered on path without crashing
Actual Behavior
App crashes with following stack trace:
System.NullReferenceException: Object reference not set to an instance of an object
at SkiaSharp.SKFont+GlyphPathCache.Dispose () [0x00016] in <94e661f937c8433bbde4a540f6b2d091>:0
at SkiaSharp.SKFont.GetTextPathOnPath (System.ReadOnlySpan`1[T] glyphs, System.ReadOnlySpan`1[T] glyphWidths, System.ReadOnlySpan`1[T] glyphPositions, SkiaSharp.SKPath path, SkiaSharp.SKTextAlign textAlign) [0x00158] in <94e661f937c8433bbde4a540f6b2d091>:0
at SkiaSharp.SKFont.GetTextPathOnPath (System.ReadOnlySpan`1[T] glyphs, SkiaSharp.SKPath path, SkiaSharp.SKTextAlign textAlign, SkiaSharp.SKPoint origin) [0x00067] in <94e661f937c8433bbde4a540f6b2d091>:0
at SkiaSharp.SKFont.GetTextPathOnPath (System.Void* text, System.Int32 length, SkiaSharp.SKTextEncoding encoding, SkiaSharp.SKPath path, SkiaSharp.SKTextAlign textAlign, SkiaSharp.SKPoint origin) [0x00042] in <94e661f937c8433bbde4a540f6b2d091>:0
at SkiaSharp.SKFont.GetTextPathOnPath (System.ReadOnlySpan`1[T] text, SkiaSharp.SKPath path, SkiaSharp.SKTextAlign textAlign, SkiaSharp.SKPoint origin) [0x00014] in <94e661f937c8433bbde4a540f6b2d091>:0
at SkiaSharp.SKFont.GetTextPathOnPath (System.String text, SkiaSharp.SKPath path, SkiaSharp.SKTextAlign textAlign, SkiaSharp.SKPoint origin) [0x00007] in <94e661f937c8433bbde4a540f6b2d091>:0
at SkiaSharp.SKCanvas.DrawTextOnPath (System.String text, SkiaSharp.SKPath path, SkiaSharp.SKPoint offset, System.Boolean warpGlyphs, SkiaSharp.SKFont font, SkiaSharp.SKPaint paint) [0x00049] in <94e661f937c8433bbde4a540f6b2d091>:0
at SkiaSharp.SKCanvas.DrawTextOnPath (System.String text, SkiaSharp.SKPath path, SkiaSharp.SKPoint offset, System.Boolean warpGlyphs, SkiaSharp.SKPaint paint) [0x0001c] in <94e661f937c8433bbde4a540f6b2d091>:0
at SkiaSharp.SKCanvas.DrawTextOnPath (System.String text, SkiaSharp.SKPath path, SkiaSharp.SKPoint offset, SkiaSharp.SKPaint paint) [0x00000] in <94e661f937c8433bbde4a540f6b2d091>:0
at SADPmini2.Drawing.RoundedButton.DrawText (SkiaSharp.SKCanvas canvas, SkiaSharp.SKRect drawingBounds) [0x00031] in /Users/geoff/Projects/SADPmini2/SADPmini2/SADPmini2/Drawing/RoundedButton.cs:301
Basic Information
- Version with issue: 2.80.1
- Last known good version: 1.86.3
- IDE: Visual Studio for Mac
- Platform Target Frameworks:
- iOS: 13.5
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (11 by maintainers)
Commits related to this issue
- SKCanvas.DrawTextOnPath v2.80.1 iOS NullReferenceException (#1408) — committed to ziriax/SkiaSharp by ziriax 4 years ago
- SKCanvas.DrawTextOnPath v2.80.1 iOS NullReferenceException (#1408) (#1410) — committed to mono/SkiaSharp by ziriax 4 years ago
I can have a look as I have an ios device.
As a temporary workaround, could you try to pass
warpGlyphs: false
toDrawTextOnPath
, and see if that works for you?