toptensoftware / RichTextKit

Rich text rendering for SkiaSharp
Other
366 stars 73 forks source link

Crash with last version of SkiaSharp #39

Closed charlenni closed 3 years ago

charlenni commented 3 years ago

Hello,

we encounter a problem, when using RichTextKit 0.3.134 with the version 2.80.2 or 2.80.3 of SkiaSharp. We get the following error message

Method not found: void SkiaSharp.SKFont.GetGlyphs(System.ReadOnlySpan`1<int>,System.Span`1<uint16>)

with the following call stack:

at Topten.RichTextKit.TextBlock.AddDirectionalRun (Topten.RichTextKit.StyleRun styleRun, System.Int32 start, System.Int32 length, Topten.RichTextKit.TextDirection direction, Topten.RichTextKit.IStyle style) [0x00057] in <19e5ac464bd84f9c875ac01889614bdc>:0 
at Topten.RichTextKit.TextBlock.BuildFontRuns () [0x002e6] in <19e5ac464bd84f9c875ac01889614bdc>:0 
at Topten.RichTextKit.TextBlock.Layout () [0x000f5] in <19e5ac464bd84f9c875ac01889614bdc>:0

We get this only on iOS, not on Android or UWP.

After updating to RichTextKit 0.4.145 and SkiaSharp 2.80.3 the error message is slightly different:

Exception in BuildFontRuns() with original length of 13 now 13, style run count 1, font run count 0, direction overrides: False

but the inner exception seems to be the same

Method not found: void SkiaSharp.SKFont.GetGlyphs(System.ReadOnlySpan`1<int>,System.Span`1<uint16>)

and a stack trace like

at Topten.RichTextKit.TextBlock.BuildFontRuns () [0x00370] in C:\Users\Brad\Projects\RichTextKit\Topten.RichTextKit\TextBlock.cs:1133 
at Topten.RichTextKit.TextBlock.Layout () [0x000f5] in C:\Users\Brad\Projects\RichTextKit\Topten.RichTextKit\TextBlock.cs:313 

Did anyone see this problem before? Are we missing something? Worked before (was it SkiaSharp 1.63?), so there must be a change while this time.

wouterst79 commented 3 years ago

Smells like https://github.com/toptensoftware/RichTextKit/issues/32#issuecomment-838820277

charlenni commented 3 years ago

@wouterst79 You are right. Added System.Memory version 4.5.4 to all of the projects and that solved the problem.