我该如何解决:System.TypeLoadException? [英] How can I troubleshoot : System.TypeLoadException?

查看:1215
本文介绍了我该如何解决:System.TypeLoadException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能告诉我一个方法来解决 System.TypeLoadException

Can you show me a way to troubleshoot System.TypeLoadException ?

我有这样的例外在我的解决方案现有的项目,我从同一个解决方案单元测试项目引用。

I am having this exception for an existing project in my solution which I reference from a unit test project in the same solution.

当我运行我的单元测试此exeption异常。他们失败,因为此异常:

This exeption is thrown when I run my unit tests. They fail because of this exception:

详细信息:

测试方法   MyErrorHandler.Test.MyTest.Parse_RecievesValidMessage_ReturnsArray   抛出异常:System.TypeLoadException:未能加载类型   MyTestNameSpace从程序集MyTestAssemblyName.Test,   版本= 1.0.0.0,文化=中性公钥= Somenumber。

Test method MyErrorHandler.Test.MyTest.Parse_RecievesValidMessage_ReturnsArray threw exception: System.TypeLoadException: Could not load type 'MyTestNameSpace' from assembly 'MyTestAssemblyName.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=Somenumber.

我应该怎么检查或者我应该开始进行调查?

What should I check or where should I start to investigate?

推荐答案

在异常消息,或者在InnerException属性,你会发现什么是请求的类型,与完全合格的名称,版本,组装。检查给定的程序集是从应用程序目录访问。可达含义在应用程序目录或应用程序的私有探测路径。

In the exception message, or maybe in an InnerException property, you might find what was the requested type, with the fully qualified name, version, assembly. Check if the given assembly is reachable from the application directory. Reachable meaning in the application directory or in the private probing path of the application.

编辑:还检查卫星组件(由该类型装载器装载失败的组件引用)可达

EDIT : also check that satellite assemblies (referenced by the assembly that the type loader fails loading) are reachable.

这篇关于我该如何解决:System.TypeLoadException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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