Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin iOS Error on try debug application on iPhone 5

When we try to debug application on device (iPhone 5) get error

MT2002: Failed to resolve "System.Linq.Expressions.BlockExpression System.Linq.Expressions.Expression::Block(System.Type,System.Collections.Generic.IEnumerable`1)"

This bug marked as solved don't help us.

https://bugzilla.xamarin.com/show_bug.cgi?id=14765

like image 730
gustavomcastro Avatar asked Jan 18 '26 06:01

gustavomcastro


2 Answers

There are a few things to consider if you use, even indirectly, System.Linq.Expressions (SLE).

  1. This requires code generation and that's not something possible under iOS. This feature is not supported on Xamarin.iOS. SLE is part of the Dynamic Language Runtime (DLR);

  2. There is partial support for SLE using an interpreter. That has been shipped with Xamarin.iOS for long time - but it only provide a subset of the features. Sadly the existing API is not 100% identical to the one used by MS and it can cause issues when building (e.g. using PCL assemblies). This is why you're getting those MT2002 errors (your assembly tries to override an non-existing member).

  3. A maintenance release of Xamarin.iOS (7.2.1+) includes a better (more features) and API-compatible SLE interpreter.

like image 111
poupou Avatar answered Jan 20 '26 18:01

poupou


You need to change your Linq statement that is causing this. I faced this problem once (I was using a third party DB), Unfortunately the actual devices don't support JIT but the simulator does. Do your Linq statement differently.

like image 44
P. Sami Avatar answered Jan 20 '26 20:01

P. Sami