Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Livecharts crash WindowsSdkPackageVersion 10.0.22621.38+ #1580

Closed
Bush-cat opened this issue Sep 3, 2024 · 25 comments
Closed

Livecharts crash WindowsSdkPackageVersion 10.0.22621.38+ #1580

Bush-cat opened this issue Sep 3, 2024 · 25 comments
Labels
bug Something isn't working requires external features We can not fix this for now, we need a feature that is out of this library.

Comments

@Bush-cat
Copy link

Bush-cat commented Sep 3, 2024

Describe the bug
When loading the Livecharts in XAML in an App with WindowsSdkPackageVersion 10.0.22621.38 or higher it crashes the App and Debugger. WindowsSdkPackageVersion 10.0.22621.34 and lower work as expected

I encountered this when I wanted to update CommunityToolkit.Mvvm from 8.2.2 to 8.3.0, I had to increase WindowsSdkPackageVersion (Microsoft.Windows.CsWinRT 2.1.1 also requires a higher version!)

CommunityToolkit.Mvvm 8.3.0 features many changes like .net8 and other things were made optional.
https://devblogs.microsoft.com/dotnet/announcing-the-dotnet-community-toolkit-830/

To Reproduce
Steps to reproduce the behavior:

  1. Set 10.0.22621.38 in Solution
  2. Make a XAML page with a livechart
<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:lvc="using:LiveChartsCore.SkiaSharpView.WinUI"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <lvc:CartesianChart />
    </Grid>
</Page>
  1. Run the app / open the Page
  2. See App and debugger crash, it didn't even save an unhandled exception

Desktop (please complete the following information):

  • OS: Windows 11 Build 22631
  • Build 22631

Additional context
LiveChartsCore.SkiaSharpView.WinUI 2.0.0-rc2.1
net8.0-windows10.0.22621.0
Microsoft.WindowsAppSDK 1.5.240802000

@Bush-cat
Copy link
Author

Bush-cat commented Sep 5, 2024

So Windows App SDK 1.6 finally released but it also requires the new SDK

This version of the Windows App SDK requires Microsoft.Windows.SDK.NET.Ref 10.0.22621.38 or later.

@torum
Copy link

torum commented Sep 5, 2024

yap same here. I got 'System.NotSupportedException' (inside WinRT.Runtime.dll) and 'System.Reflection.TargetInvocationException' (inside System.Private.CoreLib.dll) exceptions after upgrading WinAppSDK to 1.6.

@TRadigk
Copy link

TRadigk commented Sep 9, 2024

Same issue here, can't either use newer Windows App SDK Version or this Charts Control. Please fix the problem and update the package 😊

@beto-rodriguez beto-rodriguez added requires external features We can not fix this for now, we need a feature that is out of this library. bug Something isn't working labels Sep 10, 2024
@beto-rodriguez
Copy link
Owner

The problem is that LiveCharts uses the SKXamlCanvas from SkiaSharp to render the chart, this control is the one throwing.

Since WinAppSDK 1.6 is relatively new, this is probably something that will be updated soon by someone in the MS team.

Sadly, I am afraid that there not much this library can do here :( we need to wait for MS to update the dependencies of this library.

@TRadigk
Copy link

TRadigk commented Sep 12, 2024

Did you address this issue with the devs at WindowsAppSdk at github?

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Sep 18, 2024

@TRadigk not sure if the issue is on WindowsAppSdk or SkiaSharp, for now I raised the issue to SkiaSharp.

mono/SkiaSharp#3007

@Bush-cat
Copy link
Author

I guess we need to wait until the Library supports Skiasharp v3 since the new rc version does not work with it yet
Cannot create instance of type 'LiveChartsCore.SkiaSharpView.WinUI.CartesianChart'

I’ve been using your Library and appreciate your work. I noticed there was a long gap in updates before the last release candidate and 2.1 and wanted to ask if there could be more frequent updates to the repo or dev branch, at the moment it seems there's only a push when a new release was published.
I'm very interrested in seeing development happen, as this library has a lot of potential but when writing the Issue I got slightly worried the development was stalled.
I don’t mean to pressure you or ask for new builds for every change and I don’t mind force pushes on a dev branch.

@beto-rodriguez
Copy link
Owner

My plan is to maintain the library in the long term.

About frequently updates, normally I do, but as an open source project completely maintained by my resources (mostly time), sometimes things could get slower than usual. The plan is to also offer a paid version that will mitigate this effect.

About SkiaSharp 3, I really hope that this fix also comes to 2.x, because as far as I have read, there will be a lot of breaking changes in the 3.x version, I haven't seen if those changes affect the library, but I am aware that they are working in making the migration not so painful, the library will be updated to SkiaSharp 3 for sure, when? Well it depends on the effort required to do it.

@beto-rodriguez
Copy link
Owner

I guess we need to wait until the Library supports Skiasharp v3

Just to be clear, this issue is also present in the latest release of SkiaSharp 3

mono/SkiaSharp#2999

@Bush-cat
Copy link
Author

I found a reply of the Person who wrote the fix commit about 2.x

Since that is still preview and SkiaSharp is stable, I cannot really depend on it for SkiaSharp 2.x. However, the 2.x branch does not have the convenient native library that I can use. I technically can add it to 2.x but that is a lot of work, and that old branch is very iffy to build.
microsoft/CsWinRT#1645 (comment)

@Bush-cat
Copy link
Author

Bush-cat commented Sep 24, 2024

Today I tried building managed Skiasharp 2.x from source so I can patch it. I invested 3hours but it's a big mess, soo many outdated and eol things cause lots of errors, was able to supress and fix some but it's too much, at the moment I am at 237 Errors x_x.

I think I better invest the time in migrating the Library to Skiasharp 3.0 when I get the time, the patched package might not be in nuget yet but you can get it from their azure build server

@scr47One
Copy link

+1

@beto-rodriguez
Copy link
Owner

This is now working on #1622, (requires the package source https://aka.ms/skiasharp-eap/index.json) this will be published when the SkiaSharp fix is also available at NuGet.

@matthewacme
Copy link

matthewacme commented Oct 4, 2024

@beto-rodriguez Thanks for this fix.. I tried to, fork, pull down and build to check to make sure the fix also worked in our project.

Unfortunately, there are some missing files in the repository (but are listed as part of the Project),

As for the missing files that are listed in the LiveChartsCore project file but didn't come down from the fork repository are

Geo\world.geojson
.\LiveCharts.xml
.\LiveChartsCore.SkiaSharpView.WinUI.xml

image

That didn't prevent it from building however

@matthewacme
Copy link

GREAT NEWS @beto-rodriguez

I can now confirm, out in the wild, you are absolutely correct #1622 commit fixes this bug and returns your charts to operational status in WinUI running against the 1.6 SDK.

Well done to you and the SkiaSharp team.

Do you happen to have a Patreon or "buy me a coffee" option, I'd like my talk to my Company about giving you some remuneration for your hard work.

@beto-rodriguez
Copy link
Owner

@matthewacme glad to know it is working for you also!

Do you happen to have a Patreon or "buy me a coffee" option, I'd like my talk to my Company about giving you some remuneration for your hard work.

Not for now, but the library will offer a paid version in a future version, thanks for interest in supporting my work!

@matthewacme
Copy link

matthewacme commented Oct 4, 2024 via email

@ArpitViradiyaCrowncon
Copy link

Can anyone help me for how to set/configure package source "https://aka.ms/skiasharp-eap/index.json". I'm using in .Net maui.

@jpageacsys
Copy link

Can anyone help me for how to set/configure package source "https://aka.ms/skiasharp-eap/index.json". I'm using in .Net maui.

image

I believe you can add it like this in NuGet settings in Visual Studio

@SiL-RHU
Copy link

SiL-RHU commented Oct 18, 2024

I there,

Face the same issue when updating the CommunityToolkit.Mvvm to version 8.3.2 and try to generate the packages from the skiasharp-3 branch but unfortunately without any success.

After cloning the repo locally, switch to the skiasharp-3 and adapted the projects configurations to only build the WinUi version of the package.

When using the provided scripts, I'm able to generate the packages but when I use them in our application, I received the following exception:

Exception thrown: 'Microsoft.UI.Xaml.Markup.XamlParseException' in WinRT.Runtime.dll
WinRT information: Cannot locate resource from 'ms-appx:///LiveChartsCore.SkiaSharpView.WinUI/CartesianChart.xaml'.
XAML parsing failed.

I then tried to generate the package from Visual Studio 17.11.5 but get the following build error in Release:

src\skiasharp\LiveChartsCore.SkiaSharp\VisualElements\SVGVisual.cs(45,38,45,51): error CS0507: 'SVGVisual.OnInvalidated(Chart)': cannot change access modifiers when overriding 'protected internal' inherited member 'GeometryVisual<SVGPathGeometry, LabelGeometry, SkiaSharpDrawingContext>.OnInvalidated(Chart)'

Switching back the configuration to Debug solved this issue but lead to the first exception when generating the packages.

Do you have any advice on how to generate a package that contains the fix?

@beto-rodriguez
Copy link
Owner

@SiL-RHU to make it simpler and avoid building your own NuGet packages, I recommend you remove the reference to LiveCharts packages from NuGet then directly add the reference to LiveChartsCore.SkiaSharpView.Maui it is under the src/skiasharp folder.

@core2lord
Copy link

@SiL-RHU to make it simpler and avoid building your own NuGet packages, I recommend you remove the reference to LiveCharts packages from NuGet then directly add the reference to LiveChartsCore.SkiaSharpView.Maui it is under the src/skiasharp folder.

Would this work for 'LiveChartsCore.SkiaSharpView.WinUI' as well? Unfortunately, I wasn't able to figure out getting #1622 to work and I guess I broke VS2022 enough that even reverting back to 17.11.4 crashes identically, probably now requiring reinstall, but was curious if this is something I could try afterwords.

@beto-rodriguez
Copy link
Owner

Would this work for 'LiveChartsCore.SkiaSharpView.WinUI' as well? Unfortunately, I wasn't able to figure out getting #1622 to work and I guess I broke VS2022 enough that even reverting back to 17.11.4 crashes identically, probably now requiring reinstall, but was curious if this is something I could try afterwords.

It should work also, you can try before reinstalling vs .

Also if you re install the previous visual studio version you will not face this issues on Maui.

@frostshoxx
Copy link

Can anyone help me for how to set/configure package source "https://aka.ms/skiasharp-eap/index.json". I'm using in .Net maui.

image I believe you can add it like this in NuGet settings in Visual Studio

On the manage package for solution page, don't forget to select the source to skia sharp (however you name it in the settings) and select "Include Prerelease"
image

@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Oct 24, 2024

This is now working using the latest version 2.0.0-rc4.5, I will close this for now, feel free to reply if something is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working requires external features We can not fix this for now, we need a feature that is out of this library.
Projects
None yet
Development

No branches or pull requests