C#windows appication事件:应用程序启动时CLR20r3

好的,所以我创建了ac#应用程序并将其安装在我的测试盒上。 我的应用程序在我的开发盒上工作得很好,但是当我安装在另一台机器上时,它会在Main()中崩溃。 我得到了EventType:CLR20r3

这是事件消息

Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: logfileviewer.exe Problem Signature 02: 1.0.0.0 Problem Signature 03: 4f356c9c Problem Signature 04: LogFileViewer Problem Signature 05: 1.0.0.0 Problem Signature 06: 4f356c9c Problem Signature 07: 94 Problem Signature 08: 44 Problem Signature 09: System.IO.FileNotFoundException OS Version: 6.1.7601.2.1.0.256.1 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 

我使用了详细信息并在IL反汇编程序中查找错误代码并使用以下内容进行回调…

  Method #5 (06000094) ------------------------------------------------------- MethodName: .ctor (06000094) Flags : [Public] [HideBySig] [ReuseSlot] [SpecialName] [RTSpecialName] [.ctor] (00001886) RVA : 0x000081d0 ImplFlags : [IL] [Managed] (00000000) CallCnvntn: [DEFAULT] hasThis ReturnType: Void No arguments. 

.NET 4.0已卸载并重新安装在系统上,并未进行任何更改。 我在网上搜索过,每个有相同问题的人似乎都找不到解决办法。 我现在花了一天半的时间来解决这个问题。 我不想错过我的截止日期,因为无法启动应用程序。

这是我的Main()中唯一的代码

  static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain()); } 

以下是事件查看器的详细信息

  Application: LogFileViewer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at LogFileViewer.frmMain.InitializeComponent() at LogFileViewer.frmMain..ctor() at LogFileViewer.Program.Main() 

EVENTDATA

  Application: LogFileViewer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at LogFileViewer.frmMain.InitializeComponent() at LogFileViewer.frmMain..ctor() at LogFileViewer.Program.Main() 

不确定设计器如何具有FileNotFoundexception。 我正在使用DotNetBar.dll,我从安装目录中引用它,所以这应该是好的。 如果你愿意,我可以发布我的设计师,但那里有很多。 有人有主意吗?

当我的应用程序依赖于部署机器上不存在的引用程序集时,我已经看到了同样的问题。 我不确定你的意思是“从安装目录中引用DotNetBar” – 确保它在你的项目中设置为CopyLocal = true ,或者在开发和生产机器上存在于相同的完整路径上。

当我在以前在XP机器上维护的Windows 7盒子上构建应用程序时,我遇到了同样的问题。

在为Debug构建时,程序运行正常,但在为Release构建时失败并出现此错误。 我在项目的“属性”页面上找到了答案。 转到“构建”选项卡,尝试将平台目标从“任何CPU”更改为“x86”。

.NET有两个CLR 2.0和4.0。 CLR 2.0适用于.NET framework 3.5。 CLR 4.0从.NET 4.0开始运行。 您的解决方案可能使用与参考assembly不同的CLR。 在本地开发环境中,您可能同时拥有两个CLR,因此您没有遇到任何问题。 但是,当您迁移到部署环境时,它们可能只有一个CLR,并且您收到此错误。

整个上午一直在打这个,现在已经解决了,为什么会发生。 发布希望它有助于他人

我安装了Krypton.Toolkit,它自动将工具添加到Visual Studio工具箱中。 然后我将这些工具添加到设计器中,它自动将dll添加到projrect引用中,但是工具包被标记为CopyLocal = false

我使用发布版本文件夹中的所有dll构建了一个安装程序(当然上面的dll不存在)。

设置copylocal = true,然后重建安装程序,一切正常。

解决CLR20r3问题集 – Local User Policy \ Computer Configuration \ Windows Settings \ Security Settings \ Local Policies \ Security Options - System cryptography :使用符合FIPS 140的加密算法,包括加密,散列和签名 – 禁用