Chris Kooken
Chris Kooken

Reputation: 33880

MonoTouch Error when compiling: System.Boolean System.Type::op_Equality(System.Type,System.Type)

I have a MonoTouch app, when I compile it for the device, I get the following error:

Error MT2002: Can not resolve reference: System.Boolean System.Type::op_Equality(System.Type,System.Type) (MT2002)

It works fine in the simulator, however occasionally I'll get a MissingMethodException with the same type.

I have no 3rd party libraries. All of the code is my own. Any ideas?

Edit Here are my 3 projects and all their references.

Project 1: Mobile.Libraries

Project 2: Mobile.Core

Project 3: Mobile.IOS

Upvotes: 1

Views: 1560

Answers (1)

poupou
poupou

Reputation: 43553

Like @Jonathan.Peppers said this occurs when you use a compiled .dll that was built against the full, .NET4, profile.

MonoTouch Base Class Libraries (BCM) provides a superset of the Silverlight profile (2.1) with some 4.0 additions. So adding pre-compiled binaries from another framework can requires some types/methods that are not present in MonoTouch BCL.

The solution is to rebuild all your .dll against the BCL assemblies that are shipped with MonoTouch. That will ensure the compiler will only uses symbols that are available.

Why does it works on the iOS simulator ?

That's because the JIT is used. Since it's compiled Just In Time you might never reach the missing symbols so it can work until you hit the missing code (and get a runtime error).

On the other hand when you use the device (or the linker) then all the symbols are loaded (and compiled for AOT). Anything missing will be found ahead of time so you get an build-time error like the one above.

Upvotes: 1

Related Questions