I am developing C # and Mono Full AOT technology for iPhone. According to the "Limitations" page ( link text ), unlike traditional Mono / .NET, iPhone code is statically compiled ahead of time, rather than compiled upon request by the JIT compiler.
When running on hardware, the following exception occurs:
ExecutionEngineException: Attempting to JIT compile method 'System.Reflection.MonoProperty:GetterAdapterFrame<Image, UnityEngine.Color> (System.Reflection.MonoProperty/Getter`2<Image, UnityEngine.Color>,object)' while running with --aot-only. System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] Ani+AniValue.Get () Ani.CreateAnimations (System.Object obj, System.Collections.Hashtable properties, Single duration, System.Collections.Hashtable options, AniType type) Ani.Method (AniType type, System.Object obj, Single duration, System.Collections.Hashtable _properties, System.Collections.Hashtable _options) Ani.From (System.Object obj, Single duration, System.Collections.Hashtable _properties) xObject+<>c__CompilerGenerated5.MoveNext () UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) xObject:StartAnimation(Animate, GameObject, Object, Object) SceneSplash:CreateBackground() SceneSplash:OnSetup() SceneSplash:OnSceneActivate(Callback) GameController:ActivateScene() GameController:DeactivateScene() GameController:SceneLoaded(Scene, GameObject, SceneBase) SceneBase:Start()
According to the document "Constraints" System.Reflection.Emit is not supported, but they indicate that aside from Reflection.Emit "the entire Reflection API, including Type.GetType (" someClass "), listing methods, list properties, attribute selection and values ββworks just fine. "
I have included code that throws an exception ...
void CreateAnimations(System.Object obj, Hashtable properties, float duration, Hashtable options, AniType type) { foreach (DictionaryEntry item in properties) { name = (string)item.Key;
The above method captures the property name from the hash table and uses it (along with obj) to instantiate AniValue. Immediately after this, foo.Get () is called to retrieve the value of the property. An exception occurs in propertyInfo.GetValue (obj, null).
using System.Reflection public class AniValue { static BindingFlags bFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; System.Object obj;
Although I have limited experience with C #, JIT, AOT, and Reflection, should GetValue () run JIT? UnityEngine.Color is a structure, and the Image class is a subclass of xObject, which is a subclass of UnityEngine.MonoBehaviour. Color is an Image property, and it is this code that can get the value when an exception occurs.
Interestingly, you can compile the code using .NET 1.1, and everything will be fine. Only compilation using .NET 2.1 throws an exception.
I donβt know if there is a solution or what is connected with it, but I would be interested to know about the reason.