PeterDe
Topic Author
Posts: 2
Joined: 26 Oct 2015, 13:03

Exception using Noesis and .Net Compability level 2.0 on IOS

26 Oct 2015, 13:26

Hi, when running my unity application on IOS, with .NET 2.0 as Api compatibility level I get the following exception:

ExecutionEngineException: Attempting to call method 'System.Reflection.MonoProperty::GetterAdapterFrame' for which no ahead of time (AOT) code was generated.
at Noesis.Extend.GetPropertyValue_String (IntPtr unityType, Int32 propertyIndex, IntPtr cPtr) [0x00000] in <filename unknown>:0
at Noesis.UIRenderer.Noesis_CreateRenderer (IntPtr root) [0x00000] in <filename unknown>:0
at Noesis.UIRenderer..ctor (Noesis.FrameworkElement content, Vector2 offscreenSize, UnityEngine.GameObject target) [0x00000] in <filename unknown>:0
at NoesisGUIPanel.LoadXaml () [0x00000] in <filename unknown>:0
at NoesisGUIPanel.OnEnable () [0x00000] in <filename unknown>:0
Noesis.UIRenderer:Noesis_CreateRenderer(IntPtr)
Noesis.UIRenderer:.ctor(FrameworkElement, Vector2, GameObject)
NoesisGUIPanel:LoadXaml()
NoesisGUIPanel:OnEnable()


I'm forced to .Net 2.0 profile due to a plugin requiring it. When removing the plugin and reverting to .NET2.0 subset everything works. But unfortunately the plugin is needed. Do you know if Noesis should have any problems running with Unity with the desired compatibility level, or do you have an idea what could be causing this?

I'm using Unity 5.2.1f1 and version 1.2.4 of NoesisGui.
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: Exception using Noesis and .Net Compability level 2.0 on

26 Oct 2015, 16:12

This was reported a year ago in the tracker. These were our conclusions:

I have been investigating this and reading the thread:

http://forum.unity3d.com/threads/execut ... hod.43038/

And it seems that the implementation of System.Reflection.GetValue in .NET 2.0 is using generics that are incompatible with AOT, used in iOS. In that thread they propose that instead of using GetValue it can be used:
property.GetGetMethod().Invoke(object, arguments);
I have been doing tests and it seems to work, but I don't like it because it is not very efficient. There is an improvement in the link you passed (https://whydoidoit.wordpress.com/2012/0 ... mpilation/) but it requires manually tweaking of the class.

To me, this is a bug in the version of Mono being used by Unity because I don´t see this restriction explained here:

http://developer.xamarin.com/guides/ios ... mitations/

Right now this is affecting to any usage of DataContext. So I see three options:

1. Use .NET 2.0 subset and talk with those 3rdparty developers to use it also? What 3rdparty are those? Do they work properly with iOS?
2. Use .NET 2.0 full and avoid DataContext.
3. Implement something similar to the proposed link or even better, avoid reflection and implement manual functions to return the requires information (a switch with all the implemented properties) implementing an interface for example. This would require changes in NoesisGUI.
 
PeterDe
Topic Author
Posts: 2
Joined: 26 Oct 2015, 13:03

Re: Exception using Noesis and .Net Compability level 2.0 on

29 Oct 2015, 10:03

Thanks for the reply, a really good answer.

I contacted the 3rd party developers and got instructions to modify the plugin so that it now supports .NET 2.0 Subset.
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: Exception using Noesis and .Net Compability level 2.0 on

29 Oct 2015, 12:59

Thanks! Good to know you are using ".NET 2.0 Subset"
 

Who is online

Users browsing this forum: Semrush [Bot] and 39 guests