如何诊断" System.TypeLoadException"错误 [英] How to diagnose "System.TypeLoadException" error

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

问题描述

当我尝试打开我的Windows机器比我的开发计算机上的其他窗体应用程序(我称之为 MyApplication.exe ),一个对话框弹出说

When I attempt to open my Windows Forms application (I'll call it MyApplication.exe) on a machine other than my dev machine, a dialog window pops up saying:

所有MyApplication 已停止工作

MyApplication has stopped working

Windows可以为一个解决方案,在网上查询到的问题

  • 联机检查解决方案并关闭程序
  • 关闭程序

详细信息

问题签名:

  Problem Event Name:   CLR20r3
  Problem Signature 01: myapplication
  Problem Signature 02: 1.2.0.0
  Problem Signature 03: 51c34395
  Problem Signature 04: mscorlib
  Problem Signature 05: 4.0.0.0
  Problem Signature 06: 50484bd7
  Problem Signature 07: 1204
  Problem Signature 08: 89
  Problem Signature 09: System.TypeLoadException
  OS Version:   6.1.7600.2.0.0.256.48
  Locale ID:    1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789


要注意,我用ILMerge合并是很重要的 MyApplication.exe 和引用 MyLibrary.dll 组件连成一个程序集(输出的名称是 MyApplication.exe )。


It's important to note that I use ILMerge to merge the MyApplication.exe and a referenced MyLibrary.dll assemblies together into one assembly (the name of the output is MyApplication.exe).

另外,值得注意的是,该试验机能够没有任何问题运行.exe,直到我发布了添加了一个扩展方法的所有MyApplication项目的更新很重要

Also, it's important to note that the testing machines were able to run the .exe with no problems until I released an update that added an extension method to the MyApplication project.

在换句话说,当我添加了扩展方法所有MyApplication ,然后用 ILMerge 的.exe文件相结合和.dll,测试机将收到上述错误(有趣的是,我开发计算机可以运行.exe文件合并,没有任何问题)。

In other words, after I added the extension method to MyApplication, then used ILMerge to combine the .exe and .dll, the testing machines would receive the above error (Interestingly, my dev machine could run the merged .exe with no problems).

有一个已知的问题瓦特/ ILMerge和扩展方法?这听起来很奇怪,但是这是在我的code已经改变了嘛。

Is there a known issue w/ ILMerge and Extension Methods? That sounds odd, but that's the only thing that has changed in my code.

既然不能重现该问题在我的dev的机器,你对我怎么能去有关解决发生在测试机器上的 System.TypeLoadException 错误的任何建议?

Since I cannot reproduce the problem on my dev machine, do you have any advice on how I can go about troubleshooting the System.TypeLoadException error that occurs on the test machines?

系统信息

  • 定位的.NET Framework 4.0(安装了这个我所有的测试机器)
  • ILMerge版本2.12.803
  • 在开发计算机:Windows 2008的服务器R2; Visual Studio 2010的专业版
  • 客户机:XP,Win7的,Win8的和(所有的人都得到错误)

推荐答案

如果您有.NET 4.5安装到您的生成计算机上,它会如果你不小心打破。

If you have .net 4.5 installed on your build machine, it would break if your not careful.

基本上微软改变,其中1属性位于(从System.Core程序到MSCORLIB)。

Basically Microsoft changed where 1 attribute was located (from System.Core to mscorlib).

马特Wrock在<一个href="http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx"相对=nofollow>他的岗位讲述如何使用ILMerge变通办法。虽然这是为测试版,它应该与释放。

Matt Wrock in his post explains how to workaround it with ILMerge. Although this is for the beta, it should work with the release.

这篇关于如何诊断&QUOT; System.TypeLoadException&QUOT;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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