Skip to content

Managed vtable types (ie. containing any reference types) are not supported. (With WindowsSdkPackageVersion 10.0.19041.38) #2999

@inforithmics

Description

@inforithmics

Description

In this pull request I try to Update the WindowsAppSDK Dependency to 1.6.240829007

Mapsui/Mapsui#2747

This needs following Entry in the csproj File

<!-- Windows App Sdk 1.6 Workaround-->
<WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>

Which in Turn causes Managed vtable types (ie. containing any reference types) are not supported

What I discovered is that adding alone without Updating WindowsAppSdk Causes this Exception so it is a Behavior change
In the Windows App SDK Ref starting around 10.0.x.38 Versions.

<!-- Windows App Sdk 1.6 Workaround-->
<WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>

Sample the Reproduces the Crash, should display a circle could not test it it crashed before it can display anything.

From the Callstack it seems Code that is executed in SKXamlCanvas.DoInvalidate crashes the Application

App1.zip

Code

The best way to share code for larger projects is a link to a GitHub repository: https://github.com/user/repo/tree/bug-123

But, you can also share a short block of code here:

// some C# code here

You can also share some XAML:

<!-- xaml code here -->

Expected Behavior

No exception and SkiaSharp Works with WindowsAppSdk 1.6

Actual Behavior

SkiaSharp Crashes with Exception of "Which in Turn causes Managed vtable types (ie. containing any reference types) are not supported"

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

None

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Windows 11, Visual Studio 2022 Preview 17.12

Devices

Windows Packaged Windows App

Relevant Screenshots

Call Stack of Exception in the IDE.
image

Relevant Log Output

Call Stack Of Exception


WinRT.Runtime.dll!WinRT.ObjectReference<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl>.GetVtable(nint thisPtr)
WinRT.Runtime.dll!WinRT.ObjectReference<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl>.ObjectReference(nint thisPtr)
WinRT.Runtime.dll!WinRT.ObjectReference<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl>.Attach(ref nint thisPtr, System.Guid iid)
WinRT.Runtime.dll!WinRT.ObjectReference<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl>.TryAs(WinRT.IObjectReference sourceRef, System.Guid iid, out WinRT.ObjectReference<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl> objRef)
WinRT.Runtime.dll!WinRT.IObjectReference.TryAs<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl>(System.Guid iid, out WinRT.ObjectReference<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl> objRef)
WinRT.Runtime.dll!WinRT.IObjectReference.As<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl>(System.Guid iid)
WinRT.Runtime.dll!WinRT.IObjectReference.As<ABI.SkiaSharp.Views.Windows.IBufferByteAccess.Vftbl>()
[Native to Managed Transition]
[Managed to Native Transition]
System.Private.CoreLib.dll!System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(object obj, nint* args)
System.Private.CoreLib.dll!System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(object obj, System.Reflection.BindingFlags invokeAttr)
WinRT.Runtime.dll!WinRT.IWinRTObject.IsInterfaceImplementedFallback.__GetObjectReferenceViaVftbl|1_1(WinRT.IObjectReference objRef, System.Type vftblType)
WinRT.Runtime.dll!WinRT.IWinRTObject.IsInterfaceImplementedFallback(System.RuntimeTypeHandle interfaceType, bool throwIfNotImplemented)
WinRT.Runtime.dll!WinRT.IWinRTObject.System.Runtime.InteropServices.IDynamicInterfaceCastable.IsInterfaceImplemented(System.RuntimeTypeHandle interfaceType, bool throwIfNotImplemented)
System.Private.CoreLib.dll!System.Runtime.InteropServices.DynamicInterfaceCastableHelpers.IsInterfaceImplemented(System.Runtime.InteropServices.IDynamicInterfaceCastable castable, System.RuntimeType interfaceType, bool throwIfNotImplemented)
[Native to Managed Transition]
[Managed to Native Transition]
WinRT.Runtime.dll!WinRT.CastExtensions.As<SkiaSharp.Views.Windows.IBufferByteAccess>(object value)
SkiaSharp.Views.Windows.dll!SkiaSharp.Views.Windows.Utils.GetByteBuffer(Windows.Storage.Streams.IBuffer buffer)
SkiaSharp.Views.Windows.dll!SkiaSharp.Views.Windows.WindowsExtensions.GetPixels(Microsoft.UI.Xaml.Media.Imaging.WriteableBitmap bitmap)
SkiaSharp.Views.Windows.dll!SkiaSharp.Views.Windows.SKXamlCanvas.CreateBitmap(out SkiaSharp.SKSizeI unscaledSize, out float dpi)
SkiaSharp.Views.Windows.dll!SkiaSharp.Views.Windows.SKXamlCanvas.DoInvalidate()
Microsoft.InteractiveExperiences.Projection.dll!ABI.Microsoft.UI.Dispatching.DispatcherQueueHandler.Do_Abi_Invoke(nint thisPtr)
[Native to Managed Transition]
[Managed to Native Transition]
Microsoft.WinUI.dll!ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(WinRT.IObjectReference _obj, Microsoft.UI.Xaml.ApplicationInitializationCallback callback)
Microsoft.WinUI.dll!Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback callback)
Mapsui.Samples.WinUI.dll!Mapsui.Samples.WinUI.Program.Main(string[] args) Line 26


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions