什么样的问题,可能会导致TypeLoadException? [英] What kind of problem can cause a TypeLoadException?

查看:523
本文介绍了什么样的问题,可能会导致TypeLoadException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大而臃肿的软件,我想一个新的GUI元素添加进去。图形用户界面元素,用XAML和WPF写的。我创建的UI元素在单独的程序,并在大型软件引用它。这两个项目VS2010下顺利编译,但是当我运行我的应用程序获得 TypeLoadException



展望与调试例外,我得到以下信息:未能从程序集图形用户界面,等等,等等加载类型GUI.Dashboard。没有的InnerException 或任何进一步的细节。



.GNU文档中说,在没有出现此消息消息传递给异常的构造函数。我认为异常本身的生产者不知道怎么回事。



我尝试使用工具 Fuslogvw.exe 键,它有效地向我展示了一些小缺失的依赖这是不相关的。但是,它无法找到这个非常特殊的任何信息。



什么样的​​问题,都不可能抛出一个异常不精确像这样的?有没有一种方法,使Fuslogvw.exe意识到这一点得到一些细节?



感谢你在前进,



编辑:
能有效地编译我的调试符号的应用程序。当我尝试实例化包含有问题的符号引用的类的异常情况。 。即:

 类SomeClass的
{
GUI.Dashboard仪表盘;
}

和呼叫跟踪看起来魔神这样的:


在MainClass.Main

 在SomeClass..ctor()
()DIN MainClass.cs:第42行


解决方案

我终于找到了这个bug一个原因:很显然,在某些情况下,引用.exe文件不会好好工作。一些方法和类加载OK但有些失败。在另一个项目中,引用该.exe文件不会引起问题。



切换到.dll文件格式,解决了所有的问题联系起来。我认为这是在CLR中的错误。


I have a big and bloated software and I want to add a new GUI element to it. The GUI element was written using XAML and WPF. I created the UI element in a separate assembly, and reference it in the big software. The two projects compiled smoothly under VS2010, but when I run my application I get a TypeLoadException.

Looking into the exception with the debugger, I get the following message : Could not load type GUI.Dashboard from assembly GUI, blah, blah. There is no InnerException nor any further detail.

The .GNU documentation says that this message appears when there is no message passed to the constructor of the exception. I assume that the producer of the exception itself does not know how it happened.

I tried using the tool Fuslogvw.exe and it effectively showed me some minor missing dependencies which are unrelated. However, it cannot find any information on this very exception.

What kind of problem can possibly throw an imprecise exception like this one ? Is there a way to make Fuslogvw.exe aware of it to get some details ?

Thank you in advance,

Edit : I effectively compiled my application with debugging symbols. The exception happens when I try to instanciate a class containing a reference to the problematic symbol. i.e.:

class SomeClass
{
    GUI.Dashboard dashboard;
}

And the call trace looks loke this:

at SomeClass..ctor()
at MainClass.Main() din MainClass.cs:line 42

解决方案

I finally found a reason for this bug : apparently, in some cases referencing a .exe file does not work properly. Some methods and classes loads OK but some fails. In another project, referencing this .exe file cause no problem.

Switching to the .dll format solved all linking problems. I think this is a bug in the CLR.

这篇关于什么样的问题,可能会导致TypeLoadException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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