Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WinUI Quickstart crashes at startup due to SkiaSharp issue #4258

Closed
ArchieCoder opened this issue Sep 12, 2024 · 19 comments · Fixed by #4462
Closed

WinUI Quickstart crashes at startup due to SkiaSharp issue #4258

ArchieCoder opened this issue Sep 12, 2024 · 19 comments · Fixed by #4462

Comments

@ArchieCoder
Copy link

Issue:
The WinUI Quickstart https://scottplot.net/quickstart/winui/ crashes at startup

image

ScottPlot Version:
5.0.39

Code Sample:
ScottPlotApp1.zip

@ProgrammerGuy76
Copy link

Hello all!

I have the same identical issue.

I' ve tried tons of countermeasures in the previous days:

a) tried to install it on .NET 6.0 .NET 7.0 .NET 8.0 having the same issue
b) installing all the previous versions down to 5.0.15
c) manually editing the project file as suggested but without any positive result

The library working good on WPF project but crashes as described on WINUI3 project.

Any comments and/or suggestions are welcome

@ArchieCoder
Copy link
Author

@ProgrammerGuy76 Weirdly enough, it works perfectly with Uno Platform which supports WinUI as the main target.

@ProgrammerGuy76
Copy link

In past I made it work with a previous version of the package.
Unfortunately I changed PC and I cannot find the other project to make a compare.
In any case, in your same scenario, if I put the WINUI Plot inside a stack panel the system does not crash but the plot is not displayed(all the other elements inside the panel are correctly represented).
Can you confirm this behavior also in your case?

@ArchieCoder
Copy link
Author

Just tested, it does crash with a Grid but not with a StackPanel (black background - nothing shown)

@ProgrammerGuy76
Copy link

Really good to know we have the same behavior and thanks for your fast feedback.
I hope someone else will discover this issue and that will add his feedback on here too.
Tomorrow I'll perform additional tests/trials and report it here.
Many thanks

@ProgrammerGuy76
Copy link

Today I had occasion to try new ways to make it working with WINUI3 but without positive results.
I got so many times the error NETSDK1148.
I' m continuing my trials.
It sounds strange that only few of us still having this problem.
Do you know of who has been able to install and make it run ScottPlot 5.0.39 on .NET 8.0 and WINUI3?

@ProgrammerGuy76
Copy link

I' ve tried to open a more "direct" and specific topic, I hope that this will help.

@ProgrammerGuy76
Copy link

Ciao ArchieCoder, I' ve resolved following this: #4273 (comment)
I hope you'll get the same result.

@ArchieCoder
Copy link
Author

@ProgrammerGuy76 Great find, thank you!

@ArchieCoder
Copy link
Author

With the release of Uno Platform 5.4.5, the WinAppSDK 1.6 is needed. It's difficult to downgrade partial libraries. This bug becomes a blocker for devs using Uno with ScottPlot cc @agneszitte

@agneszitte
Copy link
Contributor

With the release of Uno Platform 5.4.5, the WinAppSDK 1.6 is needed. It's difficult to downgrade partial libraries. This bug becomes a blocker for devs using Uno with ScottPlot cc @agneszitte

Thanks for the details @ArchieCoder, appreciated! And thank you a lot also for opening unoplatform/uno#18350 with the details on the Uno Platform side.

@AzureGulf
Copy link

Same issue here - crash to "attached debugger" as above as soon as attempt to initialise a plot - tried downgrading WindowsAppSDK to 1.5.240802000 and all related (BuildTools, SkiaSharp, etc) as per ScottPlot.WinUI minimums for net8.0-windows10.0.1.19041 but no luck.
using vs 2022 17.11.5 with NET 8.0, WinUI 3 desktop app
Guess will need to await update from ScottPlot ...

@AzureGulf
Copy link

when testing the basic WinUI Quickstart (https://scottplot.net/quickstart/winui/), still crashes (to same "attached debugger dialogs") if I set two (or more) attributes in the WinUIPlot declaration in xaml:

<ScottPlot:WinUIPlot x:Name="WinUIPlot1" Height="600" Width="900" />

using WindsAppSDK 1.6.240923002, ScottPlot.WinUI 5.0.40, Winui 3 desktop project, target OS 10.0.22000.0 etc in either x86 or x64 debug config

If I don't specify any attribute in the xaml declaration, then it doesn't crash but just shows a blank space where plot should be ... is it just me??

@Treppon
Copy link

Treppon commented Oct 21, 2024

@AzureGulf I have the same versions of winappsdk and scottplot and get the same crash within skia.
Related or same as mono/SkiaSharp#2999 I guess.

@swharden
Copy link
Member

Hi all! My quick read of this is that it sounds like it may get fixed when SkiaSharp #2999 is fixed and a new package is available and there's not much I can do at the moment. I'll leave this ticket open until this issue is resolved.

If/when someone notices a new SkiaSharp package is available that fixes this, let me know and I'll update the dependency and publish all new ScottPlot packages ASAP. If I don't respond quickly you can @ me in the Discord #1966 and I'll make sure to prioritize resolving this issue.

Thanks everyone for your helpful discussion, and if there's something else I can do between now and then let me know!

@swharden swharden changed the title WinUI Quickstart crashes at startup WinUI Quickstart crashes at startup due to SkiaSharp issue Oct 22, 2024
@AzureGulf
Copy link

@swharden , @Treppon
this appears to work after upgrading just SkiaSharp.Views.WinUI to 3.0.0-preview.5.4
(everything else left as is. i.e. WindowsAppSDK 1.6.240923002, ScottPlot 5.0.40, etc)
obviously, will need to await stable release of SkiaSharp but great to see ScottPlot's scatter plots again :)

@ArchieCoder
Copy link
Author

Happy to report that it also works with Uno Platform with SkiaSharp 2.88.9-preview.2.2 cc @agneszitte 🥳.

Let's close the issue when it will be in non-preview.

@swharden
Copy link
Member

swharden commented Nov 8, 2024

It looks like we are out of preview 🚀

https://www.nuget.org/packages/SkiaSharp/#versions-body-tab

I'll update all projects to use SkiaSharp 2.88.9 then close this issue and publish a new package on NuGet this weekend 👍

@swharden
Copy link
Member

swharden commented Nov 8, 2024

For the record:

Package SkiaSharp.NativeAssets.WinUI 2.88.9 is not compatible with net6.0-windows10.0.18362
Package SkiaSharp.NativeAssets.WinUI 2.88.9 supports: net6.0-windows10.0.19041

so I'll bump the lowest supported version for the WinUI control to net6.0-windows10.0.19041

It's worth noting that .NET 6 goes out of support next week https://learn.microsoft.com/en-us/lifecycle/products/microsoft-net-and-net-core

swharden added a commit that referenced this issue Nov 8, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants