【问题标题】:PostSharp vs. MbUnit: TypeLoadExceptionPostSharp 与 MbUnit:TypeLoadException
【发布时间】:2012-08-09 12:52:15
【问题描述】:

我有一个带有 WPF GUI 项目的小型解决方案,库项目中的一些业务逻辑和使用 MbUnit/Gallio 的测试项目。到目前为止一切正常。

在我通过 NuGet 在其当前版本 2.1.6.4 中将 PostSharp Diagnostics Toolkit for Log4Net 添加到我的 GUI 和库项目之后,我无法在我的两个测试程序集中之一中运行测试。我总是得到一个TypeLoadException 却没有告诉我无法加载 what 类型。使用 Gallio Echo、Gallio Icarus 或 Visual Studio 测试运行程序没有任何区别。

所以我玩了一下,也将 PostSharp-Diagnostics-Toolkit-Log4Net 添加到了测试项目中。现在,当我尝试运行测试时,我得到一个 PostSharp-has-crashed-message-box,我可以查看错误详细信息。以下有趣的部分用德语告诉我 PostSharp.Toolkit.Diagnostics.LogLevel 类型无法加载。但我不知道如何解决这个问题。

虽然我的其他测试项目仍然可以正常工作,并且两个测试项目(当然)都不包含复杂的东西。运行失败的项目有一个对agsXMPP的引用,该引用仅用于断言设置了xmpp连接对象上的某些属性。我已经尝试删除这个引用以及这些断言,但是这个项目中的所有测试仍然失败,TypeLoadException。

有什么想法吗?

System.TypeLoadException Der Typ "PostSharp.Toolkit.Diagnostics.LogLevel" in der Assembly "PostSharp.Toolkit.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null" konnte nicht geladen werden。 PostSharp.Toolkit.Diagnostics.Weaver.Log4Net 在 # path:Zeile 11. bei PostSharp.Toolkit.Diagnostics.Weaver.InstrumentationPlugIn.GetBackend(String loggingBackendName) in #path:Zeile 61. bei PostSharp.Toolkit.Diagnostics.Weaver.InstrumentationPlugIn.InitializeBackend() in #path:Zeile 40. bei PostSharp.Toolkit.Diagnostics.Weaver.InstrumentationPlugIn.get_Backend() 在#path:Zeile 25. 在 PostSharp.Toolkit.Diagnostics.Weaver.Logging.LoggingAspectWeaver.Initialize() 在 #path:Zeile 29. 在 PostSharp.Sdk.AspectWeaver. AspectWeaver.^pFnf8wEt(AspectWeaverTask _0, TypeDefDeclaration _1, TokenType _2) 北 PostSharp.Sdk.AspectWeaver.AspectWeaverTask.^lp9i7ZhC(InstructionWriter _0, AspectInstanceInfo _1, StructuredDeclarationDictionary1 _2) bei PostSharp.Sdk.AspectWeaver.AspectWeaverTask.^5UGcBAoN.^qmgrNmSI(IMetadataDeclaration _0, AspectInstanceInfo _1) bei PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary1.^lNgKC+Z4(IMetadataDeclaration5327,@Fun) 1.^RdBVqi#path bei Pos tSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary1.^d+wOzSPF(IMetadataDeclaration _0, Func2 _1) 北 PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary1.^+g+TCqVg(TypeDefDeclaration _0, Func2 _1, Set1 _2) bei PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary1.^fJqG(Func2 _0) bei PostSharp.Sdk.AspectInfrastructure.StructuredDeclarationDictionary1.^fJqG(Func`3)在 PostSharp.Sdk.AspectWeaver.AspectWeaverTask.Execute() 在 PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase) 在 PostSharp.Sdk.Extensibility.Project.Execute() 在 PostSharp.Hosting.PostSharpObject.ExecuteProjects() 在 PostSharp .Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)

【问题讨论】:

  • 当堆栈跟踪不是英文 xD 时有点棘手
  • 嗯,我不记得我安装了一些语言包或其他东西,但也许 Windows 更新正在这样做(不幸的是,我必须使用德语 Windows 版本)。但是bei 表示at,我想每个人都可以插入这个;)
  • 您当前的构建目标是什么? x86、x64 还是 AnyCPU?我的第一个猜测是该库是一种架构,而您正在为另一种架构构建。
  • 我正在为 AnyCPU 构建,但即使 x86 也没有什么区别。此外,我不认为 agsXMPP 作为对工作测试项目的唯一不同引用是原因,因为我也已经将其删除以进行测试但没有成功。

标签: c# aop postsharp mbunit gallio


【解决方案1】:

我仍然不知道出了什么问题,但通过 Visual Studio 中的 NuGet 包管理器卸载并重新安装 PostSharp Diagnostics Toolkit for Log4Net 以及所有依赖项解决了问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多