toptensoftware / RichTextKit

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

MAUI: Exception in BuildFontRuns() System.TypeLoadException: Could not resolve type with token 01000034 from typeref #49

Closed mgood7123 closed 2 years ago

mgood7123 commented 2 years ago

EDIT: duplicate (mostly exact same error) found https://github.com/dotnet/maui/issues/5142

[DOTNET] ViewRootImpl: Caught exception while drawing view: System.InvalidOperationException: Exception in BuildFontRuns() with original length of 13 now 13, style run count 1, font run count 0, direction overrides: False
[DOTNET]  ---> System.TypeLoadException: Could not resolve type with token 01000034 from typeref (expected class 'System.ReadOnlySpan`1' in assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e')
[DOTNET]    at Topten.RichTextKit.TextBlock.AddDirectionalRun(StyleRun styleRun, Int32 start, Int32 length, TextDirection direction, IStyle style) in C:\Users\Brad\Projects\RichTextKit\Topten.RichTextKit\TextBlock.cs:line 1182
[DOTNET]    at Topten.RichTextKit.TextBlock.BuildFontRuns() in C:\Users\Brad\Projects\RichTextKit\Topten.RichTextKit\TextBlock.cs:line 1115
[DOTNET]    --- End of inner exception stack trace ---
[DOTNET]    at Topten.RichTextKit.TextBlock.BuildFontRuns() in C:\Users\Brad\Projects\RichTextKit\Topten.RichTextKit\TextBlock.cs:line 1133
[DOTNET]    at Topten.RichTextKit.TextBlock.Layout() in C:\Users\Brad\Projects\RichTextKit\Topten.RichTextKit\TextBlock.cs:line 313
[DOTNET]    at Topten.RichTextKit.TextBlock.Paint(SKCanvas canvas, TextPaintOptions options) in C:\Users\Brad\Projects\RichTextKit\Topten.RichTextKit\TextBlock.cs:line 359
[DOTNET]    at AndroidUI.Topten_RichTextKit_TextView.onDraw(SKCanvas canvas) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\Topten_RichTextKit_TextView.cs:line 196
[DOTNET]    at AndroidUI.View.draw(SKCanvas canvas) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 6284
[DOTNET]    at AndroidUI.View.updateDisplayListIfDirty() in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 6173
[DOTNET]    at AndroidUI.View.draw(SKCanvas canvas, View parent, Int64 drawingTime) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11159
[DOTNET]    at AndroidUI.View.drawChild(SKCanvas canvas, View child, Int64 drawingTime) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11433
[DOTNET]    at AndroidUI.View.dispatchDraw(SKCanvas canvas) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11525
[DOTNET]    at AndroidUI.View.updateDisplayListIfDirty() in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 6160
[DOTNET]    at AndroidUI.View.draw(SKCanvas canvas, View parent, Int64 drawingTime) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11159
[DOTNET]    at AndroidUI.View.drawChild(SKCanvas canvas, View child, Int64 drawingTime) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11433
[DOTNET]    at AndroidUI.View.dispatchDraw(SKCanvas canvas) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11525
[DOTNET]    at AndroidUI.View.updateDisplayListIfDirty() in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 6160
[DOTNET]    at AndroidUI.View.draw(SKCanvas canvas, View parent, Int64 drawingTime) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11159
[DOTNET]    at AndroidUI.View.drawChild(SKCanvas canvas, View child, Int64 drawingTime) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11433
[DOTNET]    at AndroidUI.View.dispatchDraw(SKCanvas canvas) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 11525
[DOTNET]    at AndroidUI.View.updateDisplayListIfDirty() in C:\Users\small\source\repos\WindowsProject1\AndroidUI\View.cs:line 6160
[DOTNET]    at AndroidUI.ViewRootImpl.updateViewTreeDisplayList(SKCanvas drawingCanvas, View view) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\ViewRootImpl.cs:line 2179
[DOTNET]    at AndroidUI.ViewRootImpl.updateRootDisplayList(SKCanvas canvas, View view, Object callbacks) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\ViewRootImpl.cs:line 2192
[DOTNET]    at AndroidUI.ViewRootImpl.draw(SKCanvas canvas, View view, AttachInfo attachInfo, Object callbacks) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\ViewRootImpl.cs:line 2138
[DOTNET]    at AndroidUI.ViewRootImpl.draw(SKCanvas canvas, Boolean fullRedrawNeeded) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\ViewRootImpl.cs:line 2076
[DOTNET]    at AndroidUI.ViewRootImpl.performDraw(SKCanvas canvas) in C:\Users\small\source\repos\WindowsProject1\AndroidUI\ViewRootImpl.cs:line 1462

this works fine in Xamarin build, but gives above in MAUI build

toptensoftware commented 2 years ago

This sounds like a problem external to RichTextKit where the ReadOnlySpan type isn't resolving correctly for some reason. Are you able to use ReadOnlySpan in other places in your project?

mgood7123 commented 2 years ago

yea, upgrading skia and all related from 80.3 to latest preview 88.0-254 fixed the problem