C# windows 应用程序事件:应用程序启动时的 CLR20r3
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9244694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C# windows application Event: CLR20r3 on application start
提问by Tyler
I created a C# application and installed it on my test box. My app works perfect on my dev box, but when I install in on a different machine it crashes in the Main(). I get the EventType: CLR20r3
我创建了一个 C# 应用程序并将其安装在我的测试盒上。我的应用程序在我的开发箱上运行得很好,但是当我安装在另一台机器上时,它在 Main() 中崩溃了。我得到事件类型:CLR20r3
here is the Event Message
这是事件消息
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
I used the details and looked up the error code in IL Disassembler and cam back with the following...
我使用了详细信息并在 IL Disassembler 中查找了错误代码,然后返回以下内容...
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 has been uninstalled and re installed on the system and did not change anything. I have searched all over the net and everyone with the same problem do not seem to have a solution. I have now spent a day and a half on this problem. I would hate to miss my deadline do to not being able to launch the application.
.NET 4.0 已被卸载并重新安装在系统上,并没有改变任何东西。我已经在网上搜索了所有遇到相同问题的人似乎都没有解决方案。我现在已经在这个问题上花了一天半的时间。我不想错过我的截止日期,因为无法启动应用程序。
This is the only code in my Main()
这是我的 Main() 中唯一的代码
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmMain());
}
Here are the details from the Event Viewer
以下是事件查看器的详细信息
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()
Not sure how the designer can have a FileNotFound Exception. I am using the DotNetBar.dll and I am referencing it out of the install directory, so that should be good. I can post my designer if you want, but there is quite a bit there.
不知道设计者怎么会有 FileNotFound 异常。我正在使用 DotNetBar.dll 并且我从安装目录中引用它,所以应该很好。如果你愿意,我可以发布我的设计师,但那里有很多。
采纳答案by RyanR
I've seen this same problem when my application depended on a referenced assembly that was not present on the deployment machine. I'm not sure what you mean by "referencing DotNetBar out of the install directory" - make sure it's set to CopyLocal=truein your project, or exists at the same full path on both your development and production machine.
当我的应用程序依赖于部署机器上不存在的引用程序集时,我已经看到了同样的问题。我不确定“从安装目录中引用 DotNetBar”是什么意思 - 确保它在您的项目中设置为CopyLocal=true,或者在您的开发和生产机器上存在于相同的完整路径中。
回答by Martin
Have been fighting this all morning and now have it solved and why it happened. Posting with the hope it helps others
整个上午一直在战斗,现在已经解决了,为什么会发生。发帖希望能帮助到其他人
I installed the Krypton.Toolkit which added the tools to the Visual studio toolbox automatically. I then added the tools to the designer, which automatically added the dll to the projrect references, however the toolkit was marked as CopyLocal=false
我安装了 Krypton.Toolkit,它会自动将工具添加到 Visual Studio 工具箱中。然后我将工具添加到设计器,它会自动将 dll 添加到项目引用中,但是工具包被标记为 CopyLocal=false
I built an installer, using all dlls in the release build folder (of course the above dll wasn't there).
我构建了一个安装程序,使用了发布构建文件夹中的所有 dll(当然上面的 dll 不存在)。
Setting copylocal=true, then rebuilding the installer, everything worked fine.
设置 copylocal=true,然后重建安装程序,一切正常。
回答by Dale Lutes
I encountered the same problem when I built an application on a Windows 7 box that had previously been maintained on an XP machine.
我在之前在 XP 机器上维护的 Windows 7 机器上构建应用程序时遇到了同样的问题。
The program ran fine when built for Debug, but failed with this error when built for Release. I found the answer on the project's Properties page. Go to the "Build" tab and try changing the Platform Target from "Any CPU" to "x86".
该程序在为 Debug 构建时运行良好,但在为 Release 构建时因此错误而失败。我在项目的属性页面上找到了答案。转到“构建”选项卡并尝试将平台目标从“任何 CPU”更改为“x86”。
回答by Revaz Kavtiashvili
To solve CLR20r3 problem set - Local User Policy \ Computer Configuration \ Windows Settings \ Security Settings \ Local Policies \ Security Options - System cryptography: Use FIPS 140 compliant cryptographic algorithms, including encryption, hashing and signing - Disable
解决 CLR20r3 问题集 - Local User Policy \ Computer Configuration \ Windows Settings \ Security Settings \ Local Policies \ Security Options - System cryptography:使用符合 FIPS 140 的加密算法,包括加密、散列和签名 - 禁用
回答by xs2mayank
.NET has two CLRs 2.0 and 4.0. CLR 2.0 works till .NET framework 3.5. CLR 4.0 works from .NET 4.0 onwards. Its possible that your solution is using a different CLR than your reference assemblies. In your local development environment, you might have both the CLRs and hence you did not faced any problem. However when you moved to deployment environments, they might have a single CLR only and you got this error.
.NET 有两个 CLR 2.0 和 4.0。CLR 2.0 一直工作到 .NET framework 3.5。CLR 4.0 从 .NET 4.0 开始工作。您的解决方案可能使用与参考程序集不同的 CLR。在您的本地开发环境中,您可能拥有两个 CLR,因此您没有遇到任何问题。但是,当您转移到部署环境时,它们可能只有一个 CLR,并且您会收到此错误。

