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 错误:给定的程序集名称或代码库无效 的相关文章

  • 如何使用 MSTest 从命令行运行 SpecFlow 场景?

    我有 Visual Studio 2010 并且我们有两个使用的 VS 解决方案 第一个是 Web 应用程序 第二个是严格用于 SpecFlow 测试 同时运行两个 Visual Studio 实例来运行 SpecFlow 功能会占用所有可
  • 当 VS2013 以管理员身份运行时,MSTest 正在删除测试结果

    我知道这听起来很奇怪 但事实就是如此 我正在使用 MSTest 来运行我的单元测试 使用VS2013 ReSharper 8 1 C 中的一些dll项目 我正在调用一些 API 函数 这就是为什么我需要 VS 以管理员身份运行 否则这些调用
  • 如何模拟 xml 进行单元测试?

    我需要对这个 GetData 方法进行单元测试 public MessageResponse GetData XmlElement requestElement MessageResponse MsgResponse new Message
  • MVC 3 中 ActionFilter 依赖注入的自定义 ActionInvoker 与自定义 FilterProvider

    谁能阐明使用自定义 ActionInvoker 的优点和缺点like so http codeclimber net nz archive 2009 02 10 how to use ninject to inject dependenci
  • 在 Unity 中的类型之间共享生命周期管理器?

    我在 Unity 文档中看到的示例让您通过输入来指定生命周期管理器new LifetimeManager 排队 所以我有这个代码 container RegisterType
  • 强制 WcfSvcHost.exe 使用我的自定义服务主机

    是否可以强制 WcfSvcHost 当我执行 F5 或在解决方案中调试另一个项目时自动执行 使用自定义 ustom 服务 通过使用服务工厂 我的自定义服务主机在我的 asp net 主机容器中运行良好 该服务工厂又调用自定义服务库 但是当
  • 如何使用 Visual Studio 2012 中的运行设置文件从代码覆盖率中排除服务引用?

    我使用自定义运行设置文件来控制检查哪些项目的代码覆盖率 我使用了 Microsoft 提供的默认模板 到目前为止已经能够毫无问题地排除我想要的项目 我的下一步操作是从代码覆盖范围中排除添加服务引用时由 Visual Studio 创建的自动
  • MSTest 相当于 NUnit 的参数化测试吗?

    NUnit 支持一项功能 您可以为要多次运行的单元测试指定一组数据输入 RowTest Row 1001 1 2 3 Row 1 1001 2 3 Row 1 2 1001 3 public void SumTests int x int
  • 无法构造 String 类型

    我正在使用 Web api 和 Unity 并且在尝试打开默认 帮助 区域时收到以下错误 InvalidOperationException The type String cannot be constructed You must co
  • 创建新实例,同时仍然使用依赖注入

    环境的快速描述 我有一个代表聊天室并依赖于记录器的类 它与具有横切关注点的系统范围记录器不同 而是与特定聊天室绑定的记录器 它将该聊天室中的所有活动记录到其唯一的日志文件中 当聊天室创建时 我想打开日志文件 当聊天室被销毁时 我想关闭日志文
  • 获取在 Unity 中实现接口的所有类型

    如果您只想知道解决方案 请跳至更新 我有一个应用程序 它使用以下代码来获取并运行许多工作方法 var type typeof IJob var types AppDomain CurrentDomain GetAssemblies Sele
  • 如何从 MSTEST 运行单个测试用例

    我正在使用 MStest 运行单个测试用例 但找不到正确的命令 I tried 1 mstest exe testcontainer testproject dll test MethodTest1这将运行从名称 MethodTest1 开
  • 需要 WCF 的完整 DI 示例

    有人有完整且有效的 WCF DI 示例吗 Every http www eggheadcafe com tutorials aspnet b428fb65 08b4 45c8 97cd 47ee1a1eaf41 composing wcf
  • MSTest 和 NHibernate

    有谁有让 MSTest 将 hibernate cfg xml 正确复制到输出目录的经验吗 我的所有 MSTest 都因找不到 hibernate cfg xml 错误而失败 我将其设置为 始终复制 但我的 MBUnit 测试通过了 您可以
  • 从命令行运行本机 VS2012/C++ 64 位单元测试

    我正在尝试从命令行运行单元测试 我尝试使用以下命令使用 mstest exe 程序 E VS Projects gt C Program Files x86 Microsoft Visual Studio 11 0 Common7 IDE
  • 维护 VS Test Project 中单元测试方法之间的上下文

    我想按顺序运行以下单元测试 使用随机数字的名称 密码等创建新客户 检索刚刚创建的客户并断言其属性包含相同的随机数 对同一用户调用 ForgotPassword 函数 并使用相同的随机数作为用户名 清楚地看到 我需要生成一次随机数 并在 3
  • TestContext.DataRow["MyColumnName"] 的替代品是什么

    在 Net Core 单元测试项目中使用 MSTest 我正在尝试使用 csv 数据源来提供测试方法的数据 以前 我会在 Net Framework 测试项目中使用如下所示的内容 DataSource Microsoft VisualStu
  • MSTest.exe (VS2012) 崩溃 QTAgent32.exe

    我正在尝试通过 cmdline 执行我们的测试 我使用VS2012 但总是出现此错误 当我在同一台机器上直接在 VS2010 中运行测试时 它们运行良好 我无法将 VS2010 用于 cmdline 因为我们的许可证错误 程序集查找不起作用
  • 静态方法中的统一

    一个可能很简单的问题 但很奇怪为什么我不知道该怎么做 Unity PRISM 和静态方法 在这种特殊情况下 需要使用扩展方法 但一般来说 如何在静态方法中访问 统一提供的实例 想想例如我想访问一个日志服务来记录我在静态方法中所做的一些事情
  • 如何处理 MSTest 中的 currentDomain.UnhandledException

    我尝试根据答案实施解决方案单元测试时如何处理其他线程引发的异常 https stackoverflow com a 934604 518530 但我仍然不明白在处理程序中要做什么 假设我有一个测试 TestMethod void Test

随机推荐

  • 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