mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.39k stars 535 forks source link

WinUI3 : SKSwapChainPanel Works fine on .Net 7.0 where as it crashes on .Net 8.0 #2958

Open AmitParmar2005 opened 1 month ago

AmitParmar2005 commented 1 month ago

Description

Create a small testing app which uses SKSwapChainPanel. Here's what I am using: Visual Studio 2022. WinUI 3 SkiaSharp - 3.0.0 Preview 4.1 SkiaSharp.View.WinUI 3.0.0-Preview 4.1 .Net 8

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 -->

<?xml version="1.0" encoding="utf-8"?> <Window x:Class="WinUI3_SKSwap_Test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:WinUI3_SKSwap_Test" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:skia="using:SkiaSharp.Views.Windows" mc:Ignorable="d">

<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top">
    <skia:SKSwapChainPanel Name="canvas" Height="900" Width="1200">   
    </skia:SKSwapChainPanel>
    <Button Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>

Expected Behavior

Should run without any issue. It should display window.

Actual Behavior

Gets an exception on .Net Version 8.0 Works fine on .Net Version 7.0

image

Full Stack Trace: image

Version of SkiaSharp

3.x (Alpha)

Last Known Good Version of SkiaSharp

2.88.2 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Windows 10

Devices

Laptop: Intel i7 processor, NVidia Graphics Card

Relevant Screenshots

image

image

The same code works fine with .Net 7.0 image

Relevant Log Output

No response

Code of Conduct

AmitParmar2005 commented 1 month ago

Please let me know if you want me to upload whole solution. It's just a simple application with SKSwapChainPanel in it.

TommiGustafsson-HMP commented 1 month ago

Is this an unpackaged app? Because I encountered a similar error here: https://github.com/dotnet/maui/issues/23737

AmitParmar2005 commented 1 month ago

It fails regardless of Packaged App or without Packaged App. I have attached sample project. Can somebody please try and confirm?

I tried deleting bin, obj folder. I also tried to uninstalled app and re-deployed the packages but nothing seems working.

WinUI_SKLmnsCanvas_Net8.zip

AmitParmar2005 commented 1 month ago

Is this an unpackaged app? Because I encountered a similar error here: dotnet/maui#23737

Sorry Friends, I take my words back. It works fine for unpacked WinUI 3 application, regardless of .net version (works on both .net 7 & .net 8). However, It crashes for packaged application. Tommi is right.

FoggyFinder commented 3 weeks ago

any updates? logs shows "Error loading EGL entry points: libGLESv2.dll" message