Closed inforithmics closed 2 weeks ago
Things I tried. 1) Update to .NET 9 no success 2) Update SkiaSharp to 3 Preview no success 3) Update WindowsSdkPackageVersion to 10.0.19041.45 no success
The only thing that helped was removing
<WindowsSdkPackageVersion>10.0.19041.45</WindowsSdkPackageVersion>
And going back to Version 1.5 of Windows AppSdk.
Because with .NET 8.0.402 the WindowsSdkPackageVersion is updated to something that works with Windows AppSDK 1.6 This error could become quite common. Affecting Maui, Uno (WinUI Target), WinUI
Or is this a Bug in the WindowsAppSDK itself?
The Problem seems to be here, in The GetPixels function. https://github.com/mono/SkiaSharp/blob/main/source/SkiaSharp.Views/SkiaSharp.Views.WinUI/UWPExtensions.cs#L180
Could this be fixed by this Commit https://github.com/mono/SkiaSharp/commit/9fde53e5f16ed37c21b7f7f96c68d9862e81148e Seems not to be included in the latest SkiaSharp 3.0 Preview (Which is from 17.July and this commit is from the 18. July)
I managed to Compile SkiaSharp locally and confirm that it works now, so this Bug was indeed fixed, But needs a SkiaSharp nuget Release.
@mattleibow This fix would also need to be backported to 2.x, ideally. Thanks!
https://github.com/mono/SkiaSharp/pull/2920
I think this pull request needs to be back ported
https://github.com/microsoft/CsWinRT/issues/1645
And this is the issue
I made an App in ,NET MAUI (8.0.91) that communicate with my BLE device and uses SkiaSharp and it works very well on Android and iOS. When I try to run it on Windows, and SkiaSharp get involved, it crashes and Visual Studio shows the dialog to select a debugger.
I use the following NuGet packages:
SkiaSharp.Views.Maui.Controls ver. 3.0.0-preview.4.1 SkiaSharp.Views.Maui.Controls.Compatibility ver. 2.88.8 SkiaSharp.Views.Maui.Core ver. 3.0.0-preview.4.1 CommunityToolkit.Mvvm ver. 8.3.2 (just to use ObservableObject)
In order to use CommunityToolkit.Mvvm ver. 8.3.2, I put the following tag to the project file: < WindowsSdkPackageVersion >10.0.19041.45 < /WindowsSdkPackageVersion >
https://github.com/CommunityToolkit/dotnet/issues/951
Here the errors Log:
2024-09-26 17:42:34.972 [MauiUnhandledExceptionManager] FirstChanceException caught: Managed vtable types (ie. containing any reference types) are not supported. Exception occurred in method: GetVtable Class: WinRT.ObjectReference`1 File: Line: 0
2024-09-26 17:42:34.974 [MauiUnhandledExceptionManager] FirstChanceException Managed vtable types (ie. containing any reference types) are not supported. (StackTrace) at WinRT.ObjectReference`1.GetVtable(IntPtr thisPtr)
2024-09-26 17:42:34.975 [MauiUnhandledExceptionManager] FirstChanceException caught: Exception has been thrown by the target of an invocation. Exception occurred in method: InvokeWithNoArgs Class: System.Reflection.MethodBaseInvoker File: Line: 0
2024-09-26 17:42:34.976 [MauiUnhandledExceptionManager] FirstChanceException Exception has been thrown by the target of an invocation. (StackTrace) at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
The program '[21316] MYAPPNAME.exe: Program Trace' has exited with code 0 (0x0). The program '[21316] MYAPPNAME.exe' has exited with code 3221226107 (0xc000027b).
@Auto72 to fix your issue either use winappsdk 10.0.19041.34 (anything lower than .38) or get the patched update from their azure build servers (there is no nuget release yet)
@Bush-cat I used the winappsdk 10.0.19041.34 and I reverted to use the NuGet library CommunityToolkit.Mvvm ver 8.2.2 and now my App works also on Windows. Thanks a lot 👍
Can you try the latest nightly on https://aka.ms/skiasharp-eap/index.json
and let me know if it starts working again? I want to do a release, but I want to make sure I fixed it.
@mattleibow I tried my app using the latest nightly build of SkiaSharp on Windows:
SkiaSharp.Views.Maui.Controls ver. 3.0.0-preview.5.3 SkiaSharp.Views.Maui.Controls.Compatibility ver. 3.0.0-alpha.1.2 SkiaSharp.Views.Maui.Core ver. 3.0.0-preview.5.3
I also used the NuGet library
CommunityToolkit.Mvvm ver. 8.3.2
And in the project file I added: < WindowsSdkPackageVersion >10.0.19041.45 < /WindowsSdkPackageVersion >
and now it works 🥳🥳🥳
@mattleibow I can also confirm that 3.0.0-preview.5.3 is working on WinAppSDK 1.6.
@mattleibow, Yes I can confirm that it works now. (SkiaSharp.Views.WinUI 3.0.0 on WindoAppSDK 1.6)
3.0.0-preview.5.3 works!
3.0.0-preview.5.3 works for me too.
I've been fighting with this issue for whole evening now. I don't even know how this happened to me. I was implementing some Microsoft Store features and suddenly my app started crashing. Yesterday everything worked fine. Stashing all changes and clean build and stuff does not help. Also the workarounds mentioned above do not help. DId I get some secret update that I'm not aware or did my windows update?
I've been fighting with this issue for whole evening now. I don't even know how this happened to me. I was implementing some Microsoft Store features and suddenly my app started crashing. Yesterday everything worked fine. Stashing all changes and clean build and stuff does not help. Also the workarounds mentioned above do not help. DId I get some secret update that I'm not aware or did my windows update?
This is in the release notes for 17.11.5: "Updated the Windows 11 SDK (10.0.26100.0) installed by Visual Studio to the October 2024 servicing build."
I was able to workaround this by adding this to my .csproj:
<WindowsSdkPackageVersion>10.0.19041.34</WindowsSdkPackageVersion>
Ah, thank you very much, that worked. At least I won't waste another evening with this
3.0.0-preview.5.3 resolves my issue!
Temporarily adding this to my csproj works, too:
<WindowsSdkPackageVersion>10.0.19041.34</WindowsSdkPackageVersion>
Where can I get the 3.0.0-preview.5.3? It's not on the nuget servers which only go until 4.1.
Can I only get that from the nightly build server?
Furhter more, is there a release timeline for version 3.0? If that is far away, will this be backported?
Where can I get the 3.0.0-preview.5.3? It's not on the nuget servers which only go until 4.1.
You need the nightly builds as nuget-feed: https://aka.ms/skiasharp-eap/index.json
@TopperDEL Thanks for the quick response. It is much appreciated. I can also confirm it works with that build.
It works :)
While on VS2022 version '17.11.5', is it correct that I'm to keep the 'LiveChartsCore.SkiaSharpView.WinUI'[2.0.0-rc3.3]
and add
'SkiaSharp.Views.WInUI'[3.0.0-preview.5.3]
After doing so, when trying to run my app or the LiveCharts WinUI sample app, I receive a different error
"Could not load type 'CropRect' from assembly 'SkiaSharp, Version=3.0.0.0"
.
Also, when adding the following to the csproj file
<WindowsSdkPackageVersion>10.0.19041.34</WindowsSdkPackageVersion>
I receive an error
minimum required SDK is '10.0.19041.38'
but dropping down to NuGet SDK version '1.5.241001000' from '1.6.240923002' did rid of this message.
@core2lord Because the latest version of LiveCharts is not running on SkiaSharp 3, you need to build #1622 to fix that.
@beto-rodriguez wow, you are on top of it thank you for such quick reply. I've cloned the repository then tried right clicking the VS2022 WinUI project -> selecting 'Pack'. Tried the different build configs ad-hoc, release, appstore, with x64 and x86, along with making the SDK, SDK builder, SkiaSharp versions matched exactly as you have shown in the #1622 commit. I've also tried running the PS scripts inside the build folder to no avail. I continue to get build errors for metadata files missing and/or unable to sign a file, etc...I will just hang my head low in embarrassment and say that I have been trying to do this since I read your comment 32 minutes after you posted it, but I don't think I'm approaching this correctly at all :/
@core2lord you just cloned the master repo and updated the skiasharp dependency? You're missing commits then, you will need this branch https://github.com/beto-rodriguez/LiveCharts2/tree/skiasharp-3
Is there any idea on when this will be released? The Azure DevOps pipeline (which we are using) is now updated that it requires this fix be in place. So no we are stuck between using a nightly build version of this package, or downgrading our pipeline and not updating to the latest WIndowsAppSDK.
This will also be a problem when updating to .Net 9 later this year.
This issue has broken my MapsUI application on windows 11. Hope this fix is released soon.
I tried with the pre-release, but it doesn't seem to be completely ready yet, as it just led to other errors.
This issue has broken my MapsUI application on windows 11. Hope this fix is released soon.
I tried with the pre-release, but it doesn't seem to be completely ready yet, as it just led to other errors.
Same it broke my mapsui.
I pushed out a new version of SkiaSharp which should have all the WASDK fixes in it.
Closing this for now as the issue is fixed for both v2 and v3 in the latest preview.
Description
In this pull request I try to Update the WindowsAppSDK Dependency to 1.6.240829007
https://github.com/Mapsui/Mapsui/pull/2747
This needs following Entry in the csproj File
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.
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:
You can also share some XAML:
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.
Relevant Log Output