Open Dave-Quick opened 1 year ago
This works fine on Xamain.Forms.
I have an example project that includes the code you see here and would be happy to upload it here.
Just found the answer to my immediate problem.
In MauiProgram.cs add .UseSkiaSharp() to the builder like this:
builder
.UseMauiApp<App>()
.UseSkiaSharp(true)
.ConfigureFonts(fonts => ...
and add namespace 'SkiaSharp.Views.Maui.Controls.Hosting':
using SkiaSharp.Views.Maui.Controls.Hosting;
SkiaSharp needs this call.
Found it here: https://mapsui.com/documentation/getting-started-maui.html
Is this documented anywhere? The only thing I could find was this:( https://learn.microsoft.com/en-us/dotnet/api/skiasharp.views.maui.controls.hosting.apphostbuilderextensions.useskiasharp?view=skiasharp-views-maui-2.88) And that really doesn't tell me much.
I'm new to maui, but not new to Xamarin.Forms or SkiaSharp. I read this article (https://learn.microsoft.com/en-us/dotnet/maui/migration/forms-projects?view=net-maui-7.0) and it didn't mention this.
It took me two days to track it down. If this work-around is the standard way to do it, it would be nice to have it documented somewhere that's easy to find.
I'll leave the bug open until I get a reply.
Description I get the above error message whenever I attempt to use the SKCanvasView control. Comment it out , it works normally, and the button appears. Uncomment it out and the problem returns.
Code
Expected Behavior It doesn't crash.
Actual Behavior It crashes.
Basic Information
Detailed IDE/OS information (click to expand)
Windows 11 Pro Version 10.022621 .net7.0windows10.0.19041.0 ```Screenshots
Reproduction Link