RivePlayer is not AoT compatible (Windows App SDK 1.6)

Aperta
#567 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp

Direzione di ricerca

Inizia da components/RivePlayer/tests/ExampleRivePlayerTestClass.cs, in particolare da ComplexAsyncLoadUIExampleWithoutDispatcherTest, e ispeziona components/RivePlayer/src/RivePlayer.cs alla riga 49. Poi leggi RiveSharp.RiveAPI.cs e le indicazioni collegate sull’interoperabilità nativa per comprendere l’errore AoT. Il lavoro è completato quando i test AoT di Windows App SDK 1.6+ possono essere eseguiti senza la DllNotFoundException segnalata e non è più necessario disabilitarli.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

nativeaot

Seems like tests are failing as a result of some issue with RivePlayer on Microsoft.WindowsAppSdk 1.6-preview1+ with AoT enabled:

System.TypeInitializationException: The type initializer for 'RiveSharp.Factory' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'rive' or one of its dependencies: The specified module could not be found. (0x8007007E)
  Stack Trace:
      at RiveSharp.RiveAPI.Factory_RegisterDelegates(FactoryDelegates delegates)
   at RiveSharp.Factory..cctor()
--- End of inner exception stack trace ---
    at RiveSharp.Scene..ctor()
   at CommunityToolkit.Labs.WinUI.Rive.RivePlayer..ctor() in /_/components/RivePlayer/src/RivePlayer.cs:line 49
   at RivePlayerExperiment.Tests.ExampleRivePlayerTestClass.ComplexAsyncLoadUIExampleWithoutDispatcherTest() in D:\a\Labs-Windows\Labs-Windows\components\RivePlayer\tests\ExampleRivePlayerTestClass.cs:line 121
   at RivePlayerExperiment.Tests.ExampleRivePlayerTestClass.<ComplexAsyncLoadUIExampleWithoutDispatcherTest_ExampleRivePlayerTestClass_Test>b__12_0() in /_/ProjectHeads/AllComponents/Tests.Wasdk/obj/x64/Release/net8.0-windows10.0.22621.0/win-x64/CommunityToolkit.Tooling.TestGen/CommunityToolkit.Tooling.TestGen.UIThreadTestMethodGenerator/ComplexAsyncLoadUIExampleWithoutDispatcherTest_ExampleRivePlayerTestClass.g.cs:line 15

Originally posted by @Arlodotexe in https://github.com/CommunityToolkit/Labs-Windows/issues/561#issuecomment-2305885605

It looks like this is happening because the Rive.RiveSharp package is using runtime marshalling to call the native binary under the hood, which isn't AoT/trim friendly.

This issue should only be present when using Wasdk 1.6+ with AoT enabled. Other platforms are unaffected, but NativeAoT is not compatible with runtime marshalling. For more information, see Native interoperability best practices.

Fixing this will require changes to the underlying library. To avoid blocking the toolkit as a whole, the tests will be disabled on Wasdk until the issue can be resolved.

Lingua principale
C#
Stelle
485
Fork
89
Merge medio
19h 46m
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CommunityToolkit/Labs-Windows

Tutte le issue di CommunityToolkit/Labs-Windows

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.