I'm working on a iOS/MonoTouch project which is using a lot of reflection. Everything works great, but when I compile the Debug|iPhone version I get the error:
error MT2002: Can not resolve reference: System.Boolean System.Reflection.PropertyInfo::op_Equality(System.Reflection.PropertyInfo,System.Reflection.PropertyInfo)
Funny thing is that the Release|iPhone build works fine.
What can be wrong?
The ==
operator overload for PropertyInfo
, which is internally named op_Equality
, is available on .NET 4.0 and later. IOW it's not available in the version of mscorlib.dll
that ships with MonoTouch (which is a superset of the Silverlight, 2.1, profile).
What's happening is likely a different version of a pre-compiled assembly that is used when building Debug (versus Release). This version uses methods that are not available in MonoTouch and this will results in errors while either linking or AOT-ing your application.
Solution: re-compile this assembly with the version of mscorlib.dll that ships with MonoTouch. This will avoid the reference to op_Equality
(and uses Equals
) and the build should work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With