Unity 错误:给定的程序集名称或代码库无效

2024-04-05

我正在使用微软统一框架并收到此错误:

********** 4/15/2012 9:46:08 AM **********
Inner Exception Type: System.IO.FileLoadException
Inner Exception: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Inner Source: mscorlib
Inner Stack Trace: 
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName)
   at Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolverImpl.SearchAssemblies(String typeNameOrAlias)
   at Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolverImpl.ResolveTypeThroughSearch(String typeNameOrAlias)
   at Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolverImpl.ResolveTypeInternal(String typeNameOrAlias)
   at Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.TypeResolverImpl.ResolveType(String typeNameOrAlias, Boolean throwIfResolveFails)
   at Microsoft.Practices.Unity.Configuration.SectionExtensionElement.GetExtensionObjectType()
   at Microsoft.Practices.Unity.Configuration.SectionExtensionElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)
   at Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.DeserializableConfigurationElement.Deserialize(XmlReader reader)
   at Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.ConfigurationElementExtensions.ReadUnwrappedElement[TElementType](ConfigurationElement baseElement, XmlReader reader, DeserializableConfigurationElementCollectionBase`1 elementCollection)
   at Microsoft.Practices.Unity.Configuration.UnityConfigurationSection.DeserializeSectionExtension(XmlReader reader)
   at Microsoft.Practices.Unity.Configuration.UnityConfigurationSection.<.cctor>b__5(UnityConfigurationSection s, XmlReader xr)
   at Microsoft.Practices.Unity.Configuration.ConfigurationHelpers.UnknownElementHandlerMap`1.ProcessElement(TContainingElement parentElement, String elementName, XmlReader reader)
   at Microsoft.Practices.Unity.Configuration.UnityConfigurationSection.OnDeserializeUnrecognizedElement(String elementName, XmlReader reader)
   at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)
   at System.Configuration.ConfigurationSection.DeserializeSection(XmlReader reader)
   at Microsoft.Practices.Unity.Configuration.UnityConfigurationSection.DeserializeSection(XmlReader reader)
   at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
   at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
   at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
   at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)
Exception Type: System.Configuration.ConfigurationErrorsException
Exception: An error occurred creating the configuration section handler for unity: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) (C:\Calico\CDT\Dev\CalicoEnergy\EIS.Application.ManinboundedContext.Tests.Integration\bin\Debug\TestResults\Cameron_CAMERON-ENVYPC 2012-04-15 09_46_06\Out\EIS.Application.ManinboundedContext.Tests.Integration.dll.config line 15)
Source: UnityContainer().LoadConfiguration()
Stack Trace: 
   at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
   at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
   at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
   at System.Configuration.ConfigurationManager.GetSection(String sectionName)
   at Microsoft.Practices.Unity.Configuration.UnityContainerExtensions.LoadConfiguration(IUnityContainer container)
   at EIS.Application.ManinboundedContext.Tests.Integration.DemandResponesAppServiceIntegrationTests.InitializeTesting(TestContext context) in C:\Calico\CDT\Dev\CalicoEnergy\EIS.Application.ManinboundedContext.Tests.Integration\DemandResponesAppServiceIntegrationTests.cs:line 48

我知道我错过了一次集会。如何确定我缺少哪个程序集?我正在运行 mstest 项目。我尝试过程序集绑定查看器,但没有结果。我已将对所有程序集的引用添加到我的测试项目中。我该如何解决这个问题? Unity 没有告诉我缺少什么程序集。


我无法让 fuslogvw 显示缺少哪些组件。

But

通过在我的测试项目的 bin\debug 目录和 mstest 创建的目录之间使用 Beyond Compare 进行比较,以使用 (\TestResults\My Machine Name 2012-04-23 09_22_24\Out) 执行测试,我能够识别丢失的组件。

我不知道 mstest 正在构建一个新目录,并且没有选择某些正在注入的类型。一旦我发现 MSTest 正在创建自己的目录,我就可以通过比较来找到问题。

供参考。缺少的是企业库类型。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Unity 错误:给定的程序集名称或代码库无效 的相关文章

  • 所有测试均通过,但 TFS 将构建标记为部分成功

    我们当前的项目涉及构建一个由 Net 应用程序控制的机器人盒子 我们与相当多的硬件库进行交互 并且我们确实设置了一个集成服务器 所有硬件都连接到它来运行夜间回归测试 不幸的是 并非系统中的所有硬件库都能与 TFS 和 MSTest 很好地集
  • 将 TDD 回顾性应用到 C# 代码库中的最佳选择

    我有一个由 5 个 C 库组成的现有框架 该框架自 2006 年以来一直得到很好的使用 并且是我的大多数项目的主要代码库 我的公司出于软件质量的原因希望推出TDD 在学习了许多教程并阅读了理论之后 我了解了 TDD 的好处 时间不是无限的
  • 为 ASP.NET Identity 配置 Unity DI

    我成功地使用 Unity 进行所有常规构造函数注入 例如存储库等 但无法使其与 ASP NET Identity 类一起使用 设置是这样的 public class AccountController ApiController priva
  • 如何在 SignalR hub 的 Unity IoC 容器中注入依赖项?

    我有一个在 ASP NET MVC 5 框架之上用 c 编写的应用程序 我实施了Unity Mvc https www nuget org packages Unity Mvc 进入我的项目 现在 我正在尝试将依赖项对象注入到我的Signa
  • 我应该如何为 Unity 和 AutoMapper 实现 MVC Bootstrapper?

    为我的 MVC 2 应用程序创建引导程序的最佳方法是什么 我正在使用 Unity 和 AutoMapper 并希望尽可能抽象它们的加载和配置 一个不错的例子在这里 http weblogs asp net rashid archive 20
  • 与需要参数的工厂方法统一

    我想使用需要参数的工厂方法在 Unity 容器中注册类型 这些参数将由统一解析 但只能在运行时解析 工厂方法代码 public static IApp Create IOne ITwo 注册码 container RegisterType
  • Log4Net 多个项目

    我在用log4net在我们的解决方案之一中 该解决方案包含多个项目 每个项目一个单元测试项目 我正在使用中描述的方法这个帖子 http blog falafel com Blogs josh eastburn 2012 04 10 usin
  • 在 VS2010 中使用 MS Test ClassInitialize() 和 TestInitialize() 而不是 NUnit

    我已经在 VS2008 中使用了 NUnit 现在正在适应 VS2010 上的 MSTest 我曾经能够在 TestSetup 中创建一个对象并在 TestCleanup 中处理它 并且每次在 NUnit 中运行测试方法时都会创建该对象 从
  • 所有对mock的调用在设置字符串参数时都必须有相应的设置

    我正在测试一个简单的方法 当我运行测试时出现错误 模拟上的所有调用都必须有相应的设置 在最后一行 dataField DefaultValue orderNumber ToString 什么会导致这种情况呢 我只是设置一个字段 void I
  • C# 中的私有方法单元测试

    Visual Studio 允许通过自动生成的访问器类对私有方法进行单元测试 我编写了一个私有方法的测试 该方法编译成功 但在运行时失败 代码和测试的相当最小的版本是 in project MyProj class TypeA privat
  • Unity 错误:给定的程序集名称或代码库无效

    我正在使用微软统一框架并收到此错误 4 15 2012 9 46 08 AM Inner Exception Type System IO FileLoadException Inner Exception The given assemb
  • 来自 Unity 配置文件的 RegisterType

    我正在从 Prism 4 迁移到 Prism 7 1 我似乎找不到已从最新 Prism 版本中删除的ConfigureContainer 方法 过去 我曾使用这种方法从文件系统加载Unity配置 对于最新版本的 Prism 库 这似乎是不可
  • 关于私有方法单元测试的问题

    在 MSTest 中 Shadowing 属性可帮助您对另一个程序集中的私有方法进行单元测试 这是相关链接 VS 生成单元测试时使用的 Shadowing 属性是什么 https stackoverflow com questions 34
  • 开始在现有代码库中进行自动化集成/单元测试

    背景 我们已经移交了一个非常大的代码库 140 万行 主要是 C 语言 该应用程序主要由 asp net 2 0 样式的 asmx Web 服务组成 用于访问 SQL Server 2008 数据库以及各种 XML 文件中的数据 没有现有的
  • Unity静态工厂扩展

    我似乎无法在任何地方找到 Microsoft Practices Unity StaticFactory dll 还有其他注册静态工厂的方法吗 寻找类似的东西 容器 RegisterFactory gt FooFactory CreateF
  • 如何在Windows窗体代码后面编写方法的单元测试

    我有想要测试的方法 但收到此错误 在创建窗口句柄之前无法在控件上调用 Invoke 或 BeginInvoke 现在我还有一个列表框 正在我正在测试的函数中填充 因此 当我将方法分离到另一个类时 这是一个问题 我理解这一点 因为表单需要首先
  • 使用全局 Web API 过滤器属性进行 Unity 依赖注入

    参考这个CodePlex 统一文章 http unity codeplex com discussions 446780我能够使用 WebAPI 控制器获取过滤器属性 如下所示 MyFilterAttribute public class
  • 如何将 MSTest 集成到 TeamCity 构建过程中

    如何在 TeamCity 中运行 MSTest 作为构建过程的一部分 有哪些陷阱 此答案专门针对 Windows 上的 TeamCity 7 1 但也可能适用于其他环境 In your TeamCity build configuratio
  • TeamCity 中代码覆盖率的属性过滤器语法

    有人知道从 Teamcity 的覆盖范围中排除代码的语法吗 我在某些方法上使用 ExcludeFromCodeCoverageAttribute 并希望排除这些方法 它在 Visual Studio 中运行良好 但我不明白如何在 TeamC
  • 使用并非为 IOC 设计的遗留应用程序避免服务定位器反模式

    我经常读到IOC 中的服务定位器是一种反模式 http blog ploeh dk 2010 02 03 ServiceLocatorIsAnAntiPattern aspx 去年 我们在工作中的应用程序中引入了 IOC 具体来说是 Nin

随机推荐

  • React Native TouchableOpacity onPress 问题

    我有一个简单的图标按钮 如下所示 class SideIcon extends Component render return
  • 使用递归将列表分解为子列表

    我正在尝试使用类型声明编写一个函数 Int Bool gt Int 我希望该功能仅添加Ints 到同一个嵌套子列表 如果布尔值是True 但是如果布尔值是False 我想要Int与下一个相关联True要添加到 a 的布尔值new子列表 例如
  • 内存不足,无法继续运行 Java 运行时环境

    我的系统有 4 GB RAM 运行 Windows 操作系统 我安装了 VMWare 来设置具有 2GB RAM 的 Ubuntu 虚拟机 在 Ubuntu 中 我打开 Eclipse 并开始编码 Eclipse 开始一次又一次关闭 我开始
  • 如何将 HostControl 实例传递给 TopShelf 中的自定义主机服务?

    This 问题已在其他地方提出 https stackoverflow com questions 28740658 how to detect if topshelf is running in console mode 但没有迹象表明我
  • 如何更新 SQL 中的选择性字段(保留部分字段不变)?

    我想用两个日期更新记录 如果没有要更新的新值 则保持现有数据不变 这是一个示例表记录 id last foo last bar 1 2010 05 30 2010 05 30 我正在使用的查询 UPDATE sampledates SET
  • Android 使用 P12 证书签署数据

    因此 我搜索了一段时间 但找不到真正需要的东西 因为出现的每个结果都与签署实际的包有关 所以基本上我所做的就是 Web 服务受到会话管理器的保护 为了获取会话号 需要将 GUID 发送到 Web 服务 在 iOS 方面 我们能够获得此设置
  • 通过 AWS API Gateway 集成模板使用 DynamoDB 的 lastEvaluatedKey 进行扫描

    我使用 AWS APIGateway 集成模板直接扫描 dynamoDB 而不是编写单独的 lambda 来处理请求 响应 但是 扫描有 1MB 的限制 这导致扫描仅限于部分数据 根据文档 我们应该重新扫描 直到找到匹配项或使用 lastE
  • 如何将 .csv 文件导入 R?

    我有这个 csv 文件 ID GRADES GPA Teacher State 3 C 2 Teacher3 MA 1 A 4 Teacher1 California 我想做的是使用 R 统计软件读取文件 并将标题读入某种列表或数组 我是
  • 有没有具有这些功能的轻量级 JDBC 包装器?

    命名参数 就像 Spring 中的 JdbcTemplate JDBC 连接设置的 XML 配置 用于查询的 XML 配置 类似休眠的东西
  • ParDo 中的侧面输出 | Apache Beam Python SDK

    由于该文档仅适用于 JAVA 我无法真正理解它的含义 它指出 虽然 ParDo 始终生成一个主输出 PCollection 作为 apply 的返回值 但您也可以让 ParDo 生成任意数量的附加输出 PCollection 如果您选择有多
  • 如何从 SQL Server 更改跟踪获取所有已更改表的列表

    如何获取在给定版本之后有任何跟踪更改的所有表 已启用更改跟踪 的列表 这将返回自上一个跟踪版本以来已更改的所有表的列表 set nocount on We want to check for changes since the previo
  • 计算段:距绝对地址的偏移量

    我可以计算一个地址Segment Offset as Segment 0x10 Offset 但如何计算相反的情况呢 例如 我怎样才能从0xF4170 to F400 0170和来自0xACF04 to ABCD 1234 您需要具有起始基
  • 为什么控件不想被删除?

    我试图删除 winform 面板中包含的所有控件 但它们只是不想被删除 其中一些被删除 有些则没有 我已经尝试了两种方法 但什么也没有 foreach foreach Control controlEntry in this content
  • int [] 和 int* 作为函数参数的区别

    这是一道面试题 有什么区别int and int 它们都是函数的输入参数 f int a int b 我的回答 For f 它们具有相同的功能 第一个是第一个元素的开始位置a 第二个指向一个int 但是 如何在不传递其他参数的情况下区分它们
  • Git 提交针对没有分支的标签

    如果我在没有创建分支的情况下查看源代码的标记版本 Git 会指示我根本不与任何分支关联 不过 很高兴让我进行更改并检查它们 这些变化去哪里了 如果我切换回 master 它们就会消失 被 master 中的内容覆盖 而且我似乎无法再次找到它
  • 三元组组合的递归 SPARQL 查询

    我使用onspy在Python中递归运行以下查询 SELECT c WHERE c rdfs subClassOf restriction restriction owl onProperty has part owl someValues
  • 使用自定义类型(Substrate FRAME 托盘 + Polkadot/Substrate 前端)

    设想 您正在开发一个框架托盘 https substrate dev docs en knowledgebase runtime frame为定制基质 https substrate dev 在存储或事件中使用自定义类型的节点 要与自定义
  • Qt:QOpenGLWidget 中的文本渲染

    我想在 QOpenGLWidget 上绘制文本标签 我尝试使用 QPainter 来完成此任务 但没有成功 文本看起来很难看并且没有抗锯齿 它在 Qt OpenGL 2dpainting 示例中看起来也很难看 然而 在也使用 OpenGL
  • 使用 firebase admin sdk 发送通知不起作用

    我正在尝试将通知从 Node js 服务器发送到 ios 应用程序 如果我从 Firebase 控制台发送通知 它似乎可以工作 但如果使用 firebase admin sdk 从我的 node js 服务器尝试 则不起作用 我按照教程ht
  • Unity 错误:给定的程序集名称或代码库无效

    我正在使用微软统一框架并收到此错误 4 15 2012 9 46 08 AM Inner Exception Type System IO FileLoadException Inner Exception The given assemb