System.ArgumentException: Token 0x02000001 resolves to the special module type representing this module

Situation: Your .NET-to-Java application runs fine when running standalone, but when launched from Visual Studio, a System.ArgumentException is thrown, with the message “Token 0x02000001 resolves to the special module type representing this module.” According to the stack trace, the exception typically originates in

Parameter name: metadataToken

at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)

This problem is due to a recent update to Telerik’s JustMock software. The update introduced some problems with .NET reflection and remoting. Uninstalling JustMock should resolve the problem.

Telerik is reportedly aware of this problem and has prepared a patch. In fact, by the time you read this post, that patch may have already been pushed out.