-
Notifications
You must be signed in to change notification settings - Fork 535
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
Blazor Client (WASM): unable to use SkiaSharp in .NET 6 #2640
Comments
Additional comment: when compiling with Visual Studio 2022 17.5.2, the application works successfully |
I see you mention that there is an update to .NET 6 SDK and you listed that there was a change in the version of SkiaSharp. Did you update both at the same time? What happens if you use the same SkiaSharp with the new .NET 6 SDK? |
Sorry for the confusion - that came from the template The change has been in the update of Visual Studio. With 17.5.2, it works. With newer versions, no. |
@curia-damiano The changes are most likely in some part of the .NET SDK. Are you able to run the following:
in the solution directory on both the working and not working setups? I am just wanting to verify the installed wasm-tools and sdk versions. |
This appears to be due to some change in the IDE for how debugging a WASM Blazor application works with respect to handling native file references. If you try |
On the Azure VM with Visual Studio 17.5.2: C:_WorksNB\BlazorApp2>dotnet --info Runtime Environment: Host: .NET SDKs installed: .NET runtimes installed: Other architectures found: Environment variables: global.json file: Learn more: Download .NET: |
On the Azure VM with Visual Studio 17.5.2: C:_WorksNB\BlazorApp2>dotnet workload list Installed Workload Ids Manifest Version Installation Sourcewasm-tools 6.0.24/6.0.400 SDK 6.0.400 Use |
Is it an option to use the 7.0 SDK for this? I see that you're on 17.5 VS which is out of support. If you upgraded to the in-support 17.6 VS and use the in-support 7.0.3xx SDK, you can use that to target 6.0 applications. The 6.0.416 SDK you're using was meant to be used with 17.3. While we don't block mismatching the SDK and VS versions, we can't test every combination and every scenario. Here's some more details on that: https://learn.microsoft.com/en-us/dotnet/core/porting/versioning-sdk-msbuild-vs#lifecycle |
On my machine, with latest VS installations: C:_WorksNB\BlazorApp2>dotnet --info Runtime Environment: Host: .NET SDKs installed: .NET runtimes installed: Other architectures found: Environment variables: global.json file: Learn more: Download .NET: |
On my machine, with latest VS installations: C:_WorksNB\BlazorApp2>dotnet workload list Installed Workload Ids Manifest Version Installation Sourcewasm-tools 6.0.22/6.0.400 SDK 6.0.400 Use Updates are avaliable for the following workload(s): wasm-tools. Run |
Hi, And in fact, the real problem is that the issue happens with latest versions of Visual Studio. With the older version 17.5.2 it works. |
I confirm that running this command on my machine with all latest VS installations, IT WORKS !!! So it's definitely a Visual Studio issue, more than a SDK issue. This is already a very good result for my customer. Now, are you able to forward this issue to the Visual Studio team? |
Is this an option? #2640 (comment)
|
When you set your TargetFramework to net6.0 you will build a net6.0 (LTS) application even when using a 7.0.xxx SDK version. The problem you are hitting is a previously unknown incompatibility with workloads when using global.json to force a 6.0.xxx version of the sdk with recent VisualStudio versions. Our recommendation is that you use the SDK that comes with the Visual Studio you want to use (remove global.json) and continue to target |
Thank you for your support, it is really appreciated! My customer will probably keep the global.json, but upgrading it to use the .NET 7 SDK solves the issue. We will keep it in this way, until migration to .NET 8. Closing this issue I want to thank all of your again for your quick support. |
Description
With the recent versions of .NET 6, it seems that something has changed and it is not possible to use SkiaSharp anymore.
Existing application that were previously running, once rebuild with latest versions of .NET 6 SDK, give errors at runtime (unable to load the SkiaSharp DLL).
Code
I attach a POC project that reproduces the problem.
Note: it works with .NET 7 SDK
If using the global.config to force to use the .NET 6 SDK, we get the wrong behavior
BlazorApp2.zip
Expected Behavior
I would expect to compile existing applications even from later versions of .NET 6
Actual Behavior
Instead we get this error in the browser console:
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
2.88.2 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Devices
No response
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: