Crash in Il2cpp PC because of MinMaxSlider in a struct

Issue #750 invalid
Amit Arnon created an issue
Creating a serialization formatter for the type 'System.Collections.Generic.List<ExposeAnimatorStateNormalizedTime.NormalizedTimeRange>' failed due to missing AOT support. 
 Please use Odin's AOT generation feature to generate an AOT dll before building, and MAKE SURE that all of the following types were automatically added to the supported types list after a scan (if they were not, please REPORT AN ISSUE with the details of which exact types the scan is missing and ADD THEM MANUALLY): 
System.Collections.Generic.List<ExposeAnimatorStateNormalizedTime.NormalizedTimeRange> (name string: 'System.Collections.Generic.List`1[[ExposeAnimatorStateNormalizedTime+NormalizedTimeRange, Assembly-CSharp]], mscorlib')
ExposeAnimatorStateNormalizedTime.NormalizedTimeRange (name string: 'ExposeAnimatorStateNormalizedTime+NormalizedTimeRange, Assembly-CSharp')
IF ALL THE TYPES ARE IN THE SUPPORT LIST AND YOU STILL GET THIS ERROR, PLEASE REPORT AN ISSUE.The exception contained the following message: 
Attempting to call method 'Sirenix.Serialization.ListFormatter`1[[ExposeAnimatorStateNormalizedTime+NormalizedTimeRange, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]::.cctor' for which no ahead of time (AOT) code was generated.

This happened on my class which is an animator State Machine class. The problematic area is this:

public class ExposeAnimatorStateNormalizedTime : SerializedStateMachineBehaviour
{
    public struct NormalizedTimeRange
    {
        [MinMaxSlider(0, 1f, true)]
        public Vector2 range;
        public bool value;
    }
}

This is crashing with the error above. Weird thing is that it happens on PC which is not even an AOT platform. I never had a need to provide AOT dll on PC before. Also, manually adding this does NOT resolve the issue.

Unity version is 2019.4.14f1 LTS
Odin version is 2.1.13
I don’t have Editor Only mode enabled as i’m using Odin Serialization elsewhere

Operating system is Windows 10.

We worked around it locally by not using MinMaxSilder.
Hope that’s enough info - it looks like a problematic bug.

Comments (2)

  1. Tor Esa Vestergaard

    This is not an error, but expected behaviour due to missing AOT support for the specified type System.Collections.Generic.List<ExposeAnimatorStateNormalizedTime.NormalizedTimeRange>, which is different from merely ExposeAnimatorStateNormalizedTime.NormalizedTimeRange - you need to add exactly the types specified, which has not been done here.

    As for why a PC build requires AOT support, that is because IL2CPP is AOT-compiled regardless of target platform. If you wish to make a PC build that does not need AOT support, switch to a regular non-IL2CPP standalone build.

  2. Amit Arnon reporter

    Huh. I didn’t know that. Because I work on other AOT platforms and they had many more AOT DLL requirements. This is the first one the PC build requires. Anyway, good to know I needed to add the List specifically. Thank you!

  3. Log in to comment