Search Unity

Timline Custom TrackAsset crashes with Hololens and .Net Native

Discussion in 'Timeline' started by stepra-3dqr, Feb 15, 2019.

  1. stepra-3dqr

    stepra-3dqr

    Joined:
    Aug 1, 2018
    Posts:
    1
    Hello everyone!

    I have an UWP app using .net backend which i have to compile with the .net native tool chain for the Windows Store release.
    I am generating a timeline with a custom track and custom playable at runtime.
    Everything works as expected in Debug and Release build. But in Master build with .net native tool chain enabled I get an 'System.InvalidOperationException' in System.Private.Reflection.Core.dll with Arg_NotGenericParameter.
    The problem comes from UnityEngine.Timeline.TrackAsset.CreateAndAddNewClipOfType(Type requestedType) which is called when I try to add my Custom PlayableAsset onto my Custom Track with track.CreateDefaultClip();

    My Custom Asset derives from PlayableAsset and my Custom Track has the TrackClipType defined.

    Code (CSharp):
    1. public class CustomAsset : PlayableAsset
    2. {...}
    Code (CSharp):
    1. [TrackClipType(typeof(CustomAsset))]
    2. [TrackBindingType(typeof(GameObject))]
    3. public class CustomTrack : TrackAsset
    4. {...}
    The call track.CreateDefaultClip(); at runtime throws an exception.

    The Exception:

    Code (CSharp):
    1. Exception thrown: 'System.InvalidOperationException' in System.Private.Reflection.Core.dll
    2. An exception of type 'System.InvalidOperationException' occurred in System.Private.Reflection.Core.dll but was not handled in user code
    3. Arg_NotGenericParameter. For more information, visit http://go.microsoft.com/fwlink/?LinkId=623485
    The StackTrace:

    Code (CSharp):
    1. at System.Reflection.Runtime.TypeInfos.RuntimeTypeInfo.get_GenericParameterAttributes() in f:\dd\ndp\fxcore\CoreRT\src\System.Private.CoreLib\src\Internal\Reflection\Core\NonPortable\RuntimeType.cs:line 123
    2.    at UnityEngine.Timeline.TrackAsset.CreateAndAddNewClipOfType(Type requestedType) in C:\buildslave\unity\build\Extensions\Timeline\Runtime\TrackAsset.cs:line 270
    3.    at UnityEngine.Timeline.TrackAsset.CreateDefaultClip() in C:\buildslave\unity\build\Extensions\Timeline\Runtime\TrackAsset.cs:line 251
    I already tested different Unity versions 2018.1.9f1 and 2018.3.2f1 but it did not solve anything.
    I also tried to make Runtime Directives in case it is a reflection problem, here I am not sure if I did it right.
    I am aware that switching to IL2CPP would solve this problem and that .net backend is deprecated. But at this stage of my project i cannot switch anymore.

    Any help is appreciated, thank you.
    Greetings
    Stepra