Description
When running a MAUI project on Android using RichTextKit to render text on a SkiaSharp SKCanvasView control the following exception is thrown:
System.TypeLoadException
Message=Could not resolve type with token 0100000b from typeref (expected class 'System.ReadOnlySpan`1' in assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e')
Repo here: https://github.com/mikegoatly/MauiExperiments/tree/main/MauiRichTextKit
I'm guessing that code is being trimmed that's needed?
Steps to Reproduce
- Create a new MAUI project
- Add a package reference to
SkiaSharp.Views.Maui.Controls
- Add
.UseSkiaSharp() to MauiProgram
- Change
MainPage.xaml to have this as content:
<Grid>
<sk:SKCanvasView PaintSurface="SKCanvasView_PaintSurface"/>
</Grid>
- Add this to
MainPage.xaml.cs:
private void SKCanvasView_PaintSurface(object sender, SkiaSharp.Views.Maui.SKPaintSurfaceEventArgs e)
{
var text = new TextBlock();
var styleManager = StyleManager.Default.Value;
styleManager.FontSize(40);
styleManager.HaloColor(SKColors.Red);
styleManager.HaloWidth(4);
styleManager.HaloBlur(2);
text.AddText("Hello MAUI!", styleManager.CurrentStyle);
text.Paint(e.Surface.Canvas, new SKPoint(100, 200));
}
Debug the app on Android (I'm using Pixel 5 - API 30 (Android 11.0 - API 30)) and get the error. Note that the app works fine when running as a Windows app.
Version with bug
Preview 13 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11 and up
Did you find any workaround?
No response
Relevant log output
No response
Description
When running a MAUI project on Android using RichTextKit to render text on a SkiaSharp
SKCanvasViewcontrol the following exception is thrown:Repo here: https://github.com/mikegoatly/MauiExperiments/tree/main/MauiRichTextKit
I'm guessing that code is being trimmed that's needed?
Steps to Reproduce
SkiaSharp.Views.Maui.Controls.UseSkiaSharp()toMauiProgramMainPage.xamlto have this as content:MainPage.xaml.cs:Debug the app on Android (I'm using
Pixel 5 - API 30 (Android 11.0 - API 30)) and get the error. Note that the app works fine when running as a Windows app.Version with bug
Preview 13 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11 and up
Did you find any workaround?
No response
Relevant log output
No response