开发者

RhinoMocks breaking the compiler in recent versions of Mono / MonoDevelop

I'm not sure exactly what broke this as I've been sporadic with my Mono/Monotouch development, but I believe it's the latest update to the mono framework. All of a sudden building my Unit Test project (which itself is a MonoTouch Library project) now breaks the compiler and it seems to be the RhinoMocks DLL (removing the reference fixes it). It looks like the RM DLL is referencing the wrong System DLL (not the MT one) but what is confusing is why this never broke before and my tests used to run fine.

I've put a simple sample SLN up on Github that reproduces the error: https://github.com/briandonahue/MonoIssue

And here is the build ouput:

  Building: Sample (Debug|iPhoneSimulator)

  Building Solution Sample

  Building: Test (Debug|iPhoneSimulator)

  Performing main compilation...
  /Developer/MonoTouch/usr/bin/smcs /noconfig "/out:/Users/brian/development/Sample/Test/bin/iPhoneSimulator/Debug/Test.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" "/r:/Users/brian/development/Sample/lib/Rhino.Mocks.dll" /nologo /warn:4 /debug:+ /debug:full /optimize- /codepage:utf8 "/define:DEBUG"  /t:library "/Users/brian/development/Sample/Test/Test.cs" 
  The class System.Diagnostics.EventLog could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089The class System.Diagnostics.TraceSource could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089


  Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
    at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
    at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 
    at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 
    at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 
    at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 
    at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
    at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 



  Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
    at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
    at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 
    at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 
    at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>开发者_如何学JAVA;:0 
    at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 
    at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
    at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
  Build complete -- 1 error, 0 warnings

  ---------------------- Done ----------------------

  Build: 1 error, 0 warnings


Seeing the same thing with mono 2.10.1 and monotouch 4.0 on the simulator. But only when Linker options are set to link all assemblies.

Works fine with Linker options set to don't link or Link SDK assemblies only.


It was mentioned that the compiler has been enhanced in latest Mono release, so I guess now the compiler can tell you "well, I just find out I should report this as an error". :)


Same problem here. You do have to Link SDK assemblies in order to run it on the device. So, if this issue is not resolved, your app won't work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜