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

WinUI 3: Unable to use CodeGen'ed animation #560

Open
KodWhat opened this issue May 26, 2024 · 4 comments
Open

WinUI 3: Unable to use CodeGen'ed animation #560

KodWhat opened this issue May 26, 2024 · 4 comments

Comments

@KodWhat
Copy link

KodWhat commented May 26, 2024

Hi,
I encounter an exception while loading a codegen'ed Lottie animation.
Trying to reference it in XAML and code-behind fails.

Using XAML, I get the following error and stacktrace:

The text associated with this error code could not be found.

Failed to assign to property 'Microsoft.UI.Xaml.Controls.AnimatedVisualPlayer.Source'. [Line: 13 Position: 5]

   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0(Int32 hr)

Using the code-behind method seems to give a more detailed error:

The type initializer for '_ICanvasPathBuilderFactory' threw an exception.

When trying to use a json file with LottieVisualSource, the same type of exception seems to happen in the background

I've tried with multiple animations, that was working in UWP. (Microsoft.Toolkit.Uwp.UI.Lottie 7.1.1)

Here's a repro project, containing the original json and codegen class:
TestLottieWinUI3.zip

WinAppSDK version: 1.5.240428000
Lottie version: 8.0.280225

@getrou
Copy link
Contributor

getrou commented May 28, 2024

Looks like your app is missing a package reference to Win2D! Just add Microsoft.Graphics.Canvas as a nuget package reference and you should be good to go.

@KodWhat
Copy link
Author

KodWhat commented May 29, 2024

Can't find a Microsoft.Graphics.Canvas on Nuget. There's a Microsoft.Graphics.Win2D, but the version 1.0.4 is installed with CommunityToolkit.WinUI.Lottie, so it should be there.

image

@getrou
Copy link
Contributor

getrou commented May 30, 2024

Yep, that's the one! Sorry I mis-spoke. Microsoft.Graphics.Canvas is the binary name (oops) while the package is Microsoft.Graphics.Win2D.

Hm, try installing it and updating to version 1.2.0, your repro works for me after I do that.

@KodWhat
Copy link
Author

KodWhat commented Jun 2, 2024

I've just tried installing the 1.0.4 version explicitly and it worked... That's quite strange that Lottie references the package but doesn't seem to be able to use it.
Upgrading to 1.2.0 also works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants