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.48k stars 538 forks source link

[BUG] SKLottieView: MAUI app crashes on Windows #3034

Closed andrasjani closed 5 days ago

andrasjani commented 2 weeks ago

Description

I'm trying to use the lottie view but the windows app crashes without any exception. In Event Viewer I can see the following error:

Faulting application name: LottieCrashDemo.exe, version: 1.0.0.0, time stamp: 0x66960000 Faulting module name: CoreMessagingXP.dll, version: 10.0.26105.1010, time stamp: 0x3cb81cec Exception code: 0xe0464645 Fault offset: 0x000000000000a387 Faulting process id: 0x0x31D0 Faulting application start time: 0x0x1DB1BEB0352070A Faulting application path: C:\Users\jania\source\repos\LottieCrashDemo\LottieCrashDemo\bin\Debug\net8.0-windows10.0.19041.0\win10-x64\AppX\LottieCrashDemo.exe Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.5_5001.275.500.0_x648wekyb3d8bbwe\CoreMessagingXP.dll Report Id: 72a83609-48cb-4cf1-bb66-7a338dde6494 Faulting package full name: com.companyname.lottiecrashdemo_1.0.0.1_x649zz4h110yvjzm Faulting package-relative application ID: App

In XAML the 'IsVisible="True"' triggers the app crash.

I have tested on Android and it works well.

Code

Demo GitHub repository: https://github.com/andrasjani/SKLottieViewCrash

            <lottie:SKLottieView
                x:Name="musicNotesLottie"
                Margin="0,-90,0,0"
                HeightRequest="360"
                IsAnimationEnabled="True"
                IsVisible="True"
                RepeatCount="199"
                RepeatMode="Restart"
                Source="musicnotes.json"
                WidthRequest="216" />

Expected Behavior

The SKLottieView should play the note animation

Actual Behavior

The app crashes after page initialization

Version of SkiaSharp

3.x-preview.4 (Current Preview)

Last Known Good Version of SkiaSharp

2.88.6 (Deprecated)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Windows 11

Devices

Desktop PC (Intel CPU x64)

Relevant Screenshots

No response

Relevant Log Output

There is no error in Visual Studio console log

Code of Conduct

Mangepange commented 2 weeks ago

Without knowing anything about the Skottie library, I would guess that this is the same issue as #3019? Which in turn is caused by #2999.

andrasjani commented 2 weeks ago

Without knowing anything about the Skottie library, I would guess that this is the same issue as #3019? Which in turn is caused by #2999.

The chance is pretty good because I had to upgrade the Maui CommunityToolkit packages which require an explicit WindowsSdkPackageVersion definition:

<WindowsSdkPackageVersion>10.0.19041.41</WindowsSdkPackageVersion>
mattleibow commented 5 days ago

Closing this for now as the issue is fixed for both v2 and v3 in the latest preview.

andrasjani commented 1 day ago

The demo project uses the SkiaSharp.Extended.UI.Maui nuget only. Applying the fix I had to add the SkiaSharp.Views.Maui.Controls transitive dependency nuget with the version 3.0.0-preview.5.4.

Now it works fine.