-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.PlatformNotSupportedException: Operation is not supported on this platform. #21
Comments
I have created a very minimalistic repository to reproduce the error on ios. It is an Xamarin.Forms project. When you start the iOs Project a exception is thrown, on Android not. https://github.com/OPunktSchmidt/NRecoLambdaParser.Issue21.XamarinForms This is the relevant test code. It is placed in App.xaml.cs and is exceuted immediately on when starting the project.
|
Oliver, do you have any idea how to fix this incompatibility on iOS? I don't have enough expertise on .net+mobile platform. It seems LambdaParser tries to create a delegate that doesn't available on ios (Func<>?). |
I haven't had a closer look. But in this depth I don't have much expertise in mobile development either. I'll take a closer look at it. I'll be on vacation next week but I'll definitely get closer to it when I'm back in the office. I'll keep you informed. |
I did some research. "Since the iOS kernel prevents an application from generating code dynamically, Xamarin.iOS does not support any form of dynamic code generation." (https://docs.microsoft.com/bg-bg/xamarin/ios/internals/limitations) Simple expressions like "val1 == val2" or "val1 > val2" seems to work on iOs, but more complex expressions like mine above not (there is a methode-call to "Contains in the expression). Maybe the method-call to "Contains" requires something from namespace System.Reflection.Emit? System.Reflection.Emit is not available due to limitations under ios. I haven't worked much with dynamic code generation and System.Linq.Expressions so far so I can't say much about it. Here are a few more interesting links: https://stackoverflow.com/questions/19666257/how-to-compile-methodcallexpression-without-dynamicinvoke I'll keep investigating... |
According to this documentation page, dynamic code generation is not supported on iOS; from the other side, NReco.LambdaParser uses only System.Expressions which should fallback to 'interpretation' mode on iOS. You reported that "val1 == val2" or "val1 > val2" work fine, so I may assume that an error may be caused by a bug related to the MethodCallExpression 'interpretation'. First of all, it is good idea to test expression like "val3.Contains(val4)" with latest Xamarin platform, maybe this issue is already solved. If this doesn't help, you can modify LambdaParser class to use Expression.Compile(true) to force interpretation mode - who knows maybe this is needed for iOS. Finally, execution of expressions on iOS 100% might be possible with own LambdaParser 'interpretation' (however this will require some development + I assume evaluation performance may be not so good). |
We are getting this Exception on iOs. On Android it works perfectly.
This is the expression string:
(val1.Contains(val2) || val3.Contains(val4) || val5.Contains(val6) || val7.Contains(val8) || val9.Contains(val10) || val11.Contains(val12) || val13.Contains(val14) || val15.Contains(val16) || val17.Contains(val18) || val19.Contains(val20))
And the values:
The text was updated successfully, but these errors were encountered: