Skip to content

[BUG] .NET MAUI app crash when new SKCanvasView() is called on Windows IoT #3136

Open
@ivosnoza

Description

Description

In our .NET MAUI 8.0 application, we create a new instance of SKCanvasView and app immediately crashes on Windows 10/11 IoT edition.

It all work well on standard Windows 10/11 Home/Pro, iOS and Android.

Now, I am on the latest 3.116.1 and I was not able to track down which version was working well. But it was failing on 2.88.9 as well when I tried.

I was able to grab a crash dump file and analyze with WinDbg. Here is what I found:

0:000> !dse
Stowed Exception Array @ 0x000002176e9a8820

Stowed Exception #1 @ 0x000002176dd9e228
	0x80131534 (FACILITY_URT - .NET CLR): Uncaught exception during type initialization.

	Stack : 0x2176e9a8670
		7ffc60448674 combase!RoOriginateLanguageException+0x54
		7ffb8b9c3b7c

>>> Associated CLR Exception <<<

Exception object: 000001d6ced9dc18
Exception type:   System.TypeInitializationException
Message:          The type initializer for 'SkiaSharp.Views.WinUI.Native.BufferExtensions' threw an exception.
InnerException:   System.Runtime.InteropServices.COMException, Use !PrintException 000001D6CED9C2B0 to see more.
StackTrace (generated):
    SP               IP               Function
    000000277897DB30 00007FFC47705D39 SkiaSharp_Views_WinUI_Native_Projection!SkiaSharp.Views.WinUI.Native.BufferExtensions.get__objRef_global__SkiaSharp_Views_WinUI_Native_IBufferExtensionsStatics()+0x9
    000000277897DB60 00007FFC47705D6D SkiaSharp_Views_WinUI_Native_Projection!SkiaSharp.Views.WinUI.Native.BufferExtensions.GetByteBuffer(Windows.Storage.Streams.IBuffer)+0xd
    000000277897DB90 00007FFC2CF561FD SkiaSharp_Views_Windows!SkiaSharp.Views.Windows.SKXamlCanvas.CreateBitmap()+0x1fd
    000000277897DC90 00007FFC2CF55C13 SkiaSharp_Views_Windows!SkiaSharp.Views.Windows.SKXamlCanvas.DoInvalidate()+0x93
    000000277897DDA0 00007FFBFB324C93 Microsoft_InteractiveExperiences_Projection!ABI.Microsoft.UI.Dispatching.DispatcherQueueHandler.Do_Abi_Invoke(IntPtr)+0x43

StackTraceString: <none>
HResult: 80131534

0:000> !PrintException /d 000001D6CED9C2B0
Exception object: 000001d6ced9c2b0
Exception type:   System.Runtime.InteropServices.COMException
Message:          Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
InnerException:   <none>
StackTrace (generated):
    SP               IP               Function
    000000277897CCA0 00007FFB8AEAF55A System_Private_CoreLib!System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32)+0x1a
    000000277897CCD0 00007FFC477049C1 SkiaSharp_Views_WinUI_Native_Projection!WinRT.BaseActivationFactory..ctor(System.String, System.String)+0xe1
    000000277897CD40 00007FFC47705DBA SkiaSharp_Views_WinUI_Native_Projection!SkiaSharp.Views.WinUI.Native.BufferExtensions..cctor()+0x2a

StackTraceString: <none>
HResult: 80040154

Code

var canvasView = new SKCanvasView();

Expected Behavior

App should not crash

Actual Behavior

App crashes

Version of SkiaSharp

3.116.0 (Current)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Windows IoT Enterprise

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions