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

Loading Lottie library causes the app to crash when it is installed from the Microsoft Store #526

Open
atiyka opened this issue Jan 9, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@atiyka
Copy link

atiyka commented Jan 9, 2023

I'm building a WPF application and using Lottie in an Xaml Islands custom component.

When packaging the desktop bridge project, I receive an App manifest validation error with the following content:

Validation error. error 80080204: App manifest validation error: Line 315, Column 27, Reason: The field "*[local-name()='Extensions']/*[local-name()='Extension']/*[local-name()='InProcessServer']/*[local-name()='ActivatableClass']" with value "Microsoft.Toolkit.Uwp.UI.Lottie.LottieVisualSource" must only be declared once. A duplicate exists on Line 64, Column 27.

The mentioned lines and the corresponding tag in the AppxManifest has the following content:

<Extension Category="windows.activatableClass.inProcessServer">
  <InProcessServer>
    <Path>UILibrary.dll</Path>
*64*    <ActivatableClass ActivatableClassId="Microsoft.Toolkit.Uwp.UI.Lottie.LottieVisualSource" ThreadingModel="both" />
    <ActivatableClass ActivatableClassId="Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider" ThreadingModel="both" />
  </InProcessServer>
</Extension>
...
<Extension Category="windows.activatableClass.inProcessServer">
  <InProcessServer>
    <Path>CLRHost.dll</Path>
*315*    <ActivatableClass ActivatableClassId="Microsoft.Toolkit.Uwp.UI.Lottie.LottieVisualSource" ThreadingModel="both" />
  </InProcessServer>
</Extension>

From this workaround, I added the following lines to the .wapproj file:

<Target Name="_RemoveWinMDFromAppxManifest" BeforeTargets="_GenerateCurrentProjectAppxManifest">
    <ItemGroup>
      <_AppxWinmdFilesToHarvest Remove="@(_AppxWinmdFilesToHarvest)" />
    </ItemGroup>
  </Target>

With this, I could achieve to not to duplicate these dependencies in the AppxManifest.xaml when creating the build, so the issue has gone and I could create the package for the Store submission.

I could upload to the store, it is published, but when I install it from the store, the app crashes when it should display a lottie animation with the following exception:

* When the Lottie is initalized from Xaml:
(0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at Windows.UI.Xaml.UIElement.Measure(Size availableSize)
   at Microsoft.Toolkit.Uwp.UI.Controls.WrapPanel.MeasureOverride(Size availableSize)

* Exception, when it is initialized from the code behind:
Cannot create instance of type 'Microsoft.Toolkit.Uwp.UI.Lottie.LottieVisualSource' [Line: 0 Position: 0]

The interesting part is that the animation is played when I install the exact same build from the local package. So, seemingly the Store modifies the package during the publish procedure, but what can I do other way?

I'm using Lottie version 7.1.1

@aborziak-ms aborziak-ms added the bug Something isn't working label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants