RhinoMocks在最新版本的Mono/MonoDevelop中破坏了编译器 [英] RhinoMocks breaking the compiler in recent versions of Mono / MonoDevelop

查看:78
本文介绍了RhinoMocks在最新版本的Mono/MonoDevelop中破坏了编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于不确定我的Mono/Monotouch开发是什么,所以我不确定到底是什么导致了这一点,但是我相信这是对Mono框架的最新更新.现在突然建立了我的单元测试项目(它本身是一个MonoTouch库项目),这打破了编译器的作用,似乎是RhinoMocks DLL(删除参考文件修复了该问题).看起来RM DLL引用了错误的系统DLL(而不是MT DLL),但令人困惑的是,为什么它以前从未中断过,而我的测试过去运行良好.

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.

我在Github上放了一个简单的示例SLN来重现该错误: https://github.com/briandonahue/MonoIssue

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

这是构建输出:

  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>: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

推荐答案

在模拟器上看到与mono 2.10.1和monotouch 4.0相同的东西.但是只有在将链接器选项设置为链接所有程序集时.

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.

将链接器选项设置为不链接或仅链接SDK程序集可以很好地工作.

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

这篇关于RhinoMocks在最新版本的Mono/MonoDevelop中破坏了编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆