RhinoMocks在最新版本的Mono / MonoDevelop中打破了编译器

时间:2011-04-09 18:54:20

标签: mono xamarin.ios monodevelop

我不确定是什么打破了这个因为我的Mono / Monotouch开发已经零星,但我相信这是单声道框架的最新更新。突然建立我的单元测试项目(它本身就是一个MonoTouch库项目)现在打破了编译器,它似乎是RhinoMocks DLL(删除引用修复它)。看起来RM DLL引用了错误的系统DLL(而不是MT),但令人困惑的是为什么它从未破坏过,而我的测试过去运行正常。

我在Github上放了一个简单的示例SLN来重现错误: 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

3 个答案:

答案 0 :(得分:2)

在模拟器上使用mono 2.10.1和monotouch 4.0看到同样的事情。但只有当Linker选项设置为链接所有程序集时才会。

可以正常工作,链接器选项设置为不链接或仅链接SDK程序集。

答案 1 :(得分:0)

有人提到编译器在最新的Mono版本中得到了增强,所以我想现在编译器可以告诉你“好吧,我发现我应该把它报告为错误”。 :)

答案 2 :(得分:0)

这里的问题相同。您必须链接SDK程序集才能在设备上运行它。因此,如果此问题未得到解决,您的应用将无效。