Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity 5.0.3f2 il2cpp problem: Attempting to call method 'System.Reflection.MonoProperty::GetterAdapt

Discussion in 'iOS and tvOS' started by ccklokwerks, Jun 10, 2015.

  1. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,771
    The fix for this issue has made it into a 2018.1 release now - it will be in 2018.1.6f1, which should be out by the end of this week.
     
    MapMan likes this.
  2. MapMan

    MapMan

    Joined:
    Oct 27, 2013
    Posts:
    38
  3. MapMan

    MapMan

    Joined:
    Oct 27, 2013
    Posts:
    38
    I would also like to reconfirm that building the game with Api compatibility set to .NET Standard 2.0 causes the game not to crash. For me, using .NET Standard 2 is not an option for now as some of the 3rd party plugins we use can't target that yet. This issue is a serious hurdle as it prevents me from making new releases for both Android and iOS.
     
  4. Ellernate

    Ellernate

    Joined:
    Aug 25, 2017
    Posts:
    81
    So I figured out that PropertyInfo.GetValue(instance, null) is actually the legacy way to do it in +.net 4.5. The newer way is just doing PropertyInfo.GetValue(instance), which appears to work fine for me using il2cpp.
     
  5. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    The legacy method should still work. The reason I use GetGetMethod and invoke it is due to an older legacy issue with iOS to support older unity versions.
     
  6. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Check the last page of the json .net for unity thread (link in my signature). I posted a unitypackage and instructions. That package is built with .net 4.6 and it works even pre-unity fix.
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,771
    This should be corrected with .NET 4.x Api Compatibility Level as well in 2018.1.6f1. Do you mind submitted a new bug report so that we can investigate it? There may be a different path through the class libraries we missed.
     
  8. dradog33

    dradog33

    Joined:
    Nov 3, 2017
    Posts:
    9
    This still appears broken using the Bolt plugin and building for WebGL still get the following error: Failed to deserialize scriptable object.
    System.Runtime.Serialization.SerializationException: Deserialization into 'Bolt.FlowMacro' failed. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ExecutionEngineException: Attempting to call method 'System.Reflection.MonoProperty::GetterAdapterFrame' for which no ahead of time (AOT) code was generated.
    Just posted a bug. Let me know if there is anything I can do to help fix this.
     
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,771
    Can you let me know the bug number.
     
  10. dradog33

    dradog33

    Joined:
    Nov 3, 2017
    Posts:
    9
    (Case 1052938) Missing AOT code when compiling with IL2CPP and .Net 4.x API for WebGL using the Bolt Visual Scripting Plugin
     
    JoshPeterson likes this.
  11. guydunkski

    guydunkski

    Joined:
    Aug 16, 2017
    Posts:
    5
    Can someone provide a link to the bug, can't seem to find it on the issue tracker
     
  12. dradog33

    dradog33

    Joined:
    Nov 3, 2017
    Posts:
    9
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,771
    We will have a public link on the issue tracker once this is processed by our QA team.
     
  14. huran438

    huran438

    Joined:
    Jun 12, 2013
    Posts:
    11
    Hi! I have same error too. iOS and Android, IL2CPP, 2018.1.6f1:

    ExecutionEngineException: Attempting to call method 'System.Reflection.MonoProperty::GetterAdapterFrame<SP.Scripts.Data.Statuses.MissionStatus,System.Boolean>' for which no ahead of time (AOT) code was generated.

    System.Reflection.MonoProperty+GetterAdapter.Invoke (System.Object _this) (at <00000000000000000000000000000000>:0)
    System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Utilities.ReflectionUtils.GetMemberValue (System.Reflection.MemberInfo member, System.Object target) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.ReflectionValueProvider.GetValue (System.Object target) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContainerContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract& memberContract, System.Object& memberValue) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary (Newtonsoft.Json.JsonWriter writer, System.Collections.IDictionary values, Newtonsoft.Json.Serialization.JsonDictionaryContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value) (at <00000000000000000000000000000000>:0)
    SP.Scripts.Controllers.Missions.MissionsController.UnlockMission (SP.Scripts.Types.Mission mission) (at <00000000000000000000000000000000>:0)
    SP.Scripts.Root.InitializationSetup.Initialize (System.Boolean isDebug) (at <00000000000000000000000000000000>:0)
    SF.Core.Root.SFContextRoot.Init () (at <00000000000000000000000000000000>:0)
    Rethrow as TargetInvocationException: Exception has been

    Ilya Khurani, [03.07.18 20:42]
    thrown by the target of an invocation.
    System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Utilities.ReflectionUtils.GetMemberValue (System.Reflection.MemberInfo member, System.Object target) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.ReflectionValueProvider.GetValue (System.Object target) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContainerContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract& memberContract, System.Object& memberValue) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary (Newtonsoft.Json.JsonWriter writer, System.Collections.IDictionary values, Newtonsoft.Json.Serialization.JsonDictionaryContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value) (at <00000000000000000000000000000000>:0)
    SP.Scripts.Controllers.Missions.MissionsController.UnlockMission (SP.Scripts.Types.Mission mission) (at <00000000000000000000000000000000>:0)
    SP.Scripts.Root.InitializationSetup.Initialize (System.Boolean isDebug) (at <00000000000000000000000000000000>:0)
    SF.Core.Root.SFContextRoot.Init () (at <00000000000000000000000000000000>:0)
    Rethrow as JsonSerializationException: Error getting value from 'IsUnlocked' on 'SP.Scripts.Data.Statuses.MissionStatus'.
    Newtonsoft.Json.Serialization.ReflectionValueProvider.GetValue (System.Object target) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Jso

    Ilya Khurani, [03.07.18 20:42]
    n.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContainerContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract& memberContract, System.Object& memberValue) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary (Newtonsoft.Json.JsonWriter writer, System.Collections.IDictionary values, Newtonsoft.Json.Serialization.JsonDictionaryContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) (at <00000000000000000000000000000000>:0)
    Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value) (at <00000000000000000000000000000000>:0)
    SP.Scripts.Controllers.Missions.MissionsController.UnlockMission (SP.Scripts.Types.Mission mission) (at <00000000000000000000000000000000>:0)
    SP.Scripts.Root.InitializationSetup.Initialize (System.Boolean isDebug) (at <00000000000000000000000000000000>:0)
    SF.Core.Root.SFContextRoot.Init () (at <00000000000000000000000000000000>:0)
     
  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,771
    Thanks, we'll have a look at the bug report that was submitted for this issue. If we need more information about it, I'll ask for a bug report from this project. It looks similar to the bug report that was submitted.
     
  16. huran438

    huran438

    Joined:
    Jun 12, 2013
    Posts:
    11
    Ok. Thanks.
     
  17. LucasTaniolo

    LucasTaniolo

    Joined:
    Jul 3, 2012
    Posts:
    3
    Any update about this issue? It stops me from releasing an iOS update because of Marklight for Unity.
     
    andre-ivankio likes this.
  18. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    I recently experienced the same issue with 2018.3.b2. Using Json.Net.Unity3D, IL2CPP (HoloLens build) with .NET 4.x framework. I just want to serialize a simple POCO class, only simple datatypes being stored via Properties. Extending the link.xml does not seem to do the trick.
     
  19. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,771
    Can you submit a bug report for this issue? It should be corrected in 2018.3, so I'd like to understand the cause of this problem.
     
  20. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    Submitted via the Unity Bugtracker right now. I will update with a ticket number as soon as I have one.

    Update: It's Case 1084624
     
    JoshPeterson likes this.
  21. nilsubimax

    nilsubimax

    Joined:
    Apr 3, 2017
    Posts:
    17
    My workaround until today was to not use public properties but member attributes. While working on something unrelated today I found that adding the following to my link.xml solved the issue:

    Code (csharp):
    1.  
    2. <assembly fullname="System">
    3.     <!-- Need to use Newtonsoft Json.NET library with IL2CPP build. -->
    4.     <namespace fullname="System.ComponentModel" preserve="all" ignoreIfMissing="1"/>
    5. </assembly>
    6.  
    I found that part of code in Microsofts AppCenter package:
    https://github.com/Microsoft/AppCenter-SDK-Unity/releases

    I changed back to public properties again, they get serialized as expected now.
     
    dzmitry-lahoda likes this.
  22. dzmitry-lahoda

    dzmitry-lahoda

    Joined:
    Oct 9, 2018
    Posts:
    4