错误 clr20r3 .NET Windows 应用程序 Visual Studio 2010

发布于 2024-11-26 21:28:26 字数 662 浏览 1 评论 0原文

我们有一个使用 Visual Studio 2010 开发的基于 .NET 的 Windows 应用程序。该应用程序是使用 .NET Framework 2.0 的目标框架构建的。我们以 .NET 3.5 SP1 作为工作平台(前提条件)来发布该应用程序。总的来说,这个应用程序在我们的大多数客户中运行得很好。但其中之一目前遇到了问题。应用程序时不时地(间歇性地)遇到致命错误,并被强制关闭,除了“应用程序遇到问题,需要关闭。对于给您带来的不便,我们深表歉意”之外,不会抛出任何错误消息。我们可以获得的唯一信息来自 Windows 事件查看器。错误详细信息如下:

来源:.NET Runtime 2.0 Error
事件类型:clr20r3,
P1:应用程序.exe
P2:6.0.0.0
P3:4dee1ecd
P4:系统.windows.forms
P5:2.0.0.0
P6:4889dee7
P7:16cf
P8:159
P9: 系统.组件模型.win32
P10: NIL

当应用程序崩溃时,用户正在执行不同的操作。我们设置了一台运行 Windows XP Professional 的虚拟机,这是我们的客户正在使用的操作系统。在测试环境上一切都运行得很好。我们永远无法复制这个问题。

任何人有任何想法或想法吗?

任何评论都将受到高度赞赏。

We have a .NET based Windows application developed with Visual Studio 2010. This application is built with the target framework of .NET Framework 2.0. We are shipping the application with .NET 3.5 SP1 as the working platform (prerequisite). In general, this application has been running very well with most of our customers. But one of them has got a problem at the moment. The application encounters fatal error from time to time (intermittently) and is forced to shut down without throwing any error messages apart from "App has encountered a problem and needs to close. We are sorry for the inconvenience.". The only information we can get is from the Windows event viewer. The error details are as follows:

Source: .NET Runtime 2.0 Error
EventType: clr20r3,
P1: App.exe
P2: 6.0.0.0
P3: 4dee1ecd
P4: system.windows.forms
P5: 2.0.0.0
P6: 4889dee7
P7: 16cf
P8: 159
P9: system.componentmodel.win32
P10: NIL

When the application crashes, the user were performing different operations. We set up a virtual machine with the Windows XP Professional on, which is the OS our customer is using. Everything was running perfectly OK on the testing environment. We never be able to replicate this issue.

Any body has got any ideas or thoughts?

Any comments are highly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡墨 2024-12-03 21:28:26

当 Windows 窗体应用程序在消息泵之外遇到未处理的错误时,我在事件日志中看到了此错误(或至少有一个类似的错误,这是不久前的情况) - 您应该检查以确保您的 < code>Main 方法和所有后台线程都有 try-catch 块,(或者您处理 UnhandledException 事件):

[STAThread]
static void Main()
{
    try
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
    catch (Exception ex)
    {
        // Log me
    }
}

请注意,在发布的示例中,通常不会使用上面的 catch 块,因为这些方法通常不会抛出异常例外情况,但是如果您更改了 UnhandledExceptionMode 或者做任何可能在消息泵之外引发异常的事情都可能会给您带来您所看到的行为。

I have seen this error (or at least one similar to it, this was a while ago) appear in the event log when a Windows forms application encounters an unhandled error ouside of the message pump - you should check to make sure that both your Main method and all background threads have try-catch blocks, (or you handle the UnhandledException event):

[STAThread]
static void Main()
{
    try
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
    catch (Exception ex)
    {
        // Log me
    }
}

Note that in example posted the above catch block would not normally be used as these methods don't usually throw exceptions, however if you have changed your UnhandledExceptionMode or do anything that might throw an exception outside of your message pump then this might give you the behaviour you are seeing.

旧情别恋 2024-12-03 21:28:26

不要依赖 Windows 日志。相反,要自己纠正错误;您可以做的是处理应用程序抛出的任何异常,记录它,然后重新启动您的应用程序:
所以在你的主要部分:

AppDomain.CurrentDomain.UnhandledException += OnCurrentDomain_UnhandledException;

//Add these too if you are in windows forms application
Application.ThreadException += OnApplication_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

然后,如果抛出异常,只需记录它,你也可以重新启动你的应用程序

private static void OnCurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
#if DEBUG
    System.Diagnostics.Debugger.Break();//we will break here if we are in debug mode.
#endif//DEBUG

    LogException(e);//maybe send email to you also.
    RestartTheApplication();    
}

Don`t rely on the windows log. instead right the bug your self; you can do is to handle any exceptions thrown by your application, log it, then restart your application:
So at your main:

AppDomain.CurrentDomain.UnhandledException += OnCurrentDomain_UnhandledException;

//Add these too if you are in windows forms application
Application.ThreadException += OnApplication_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

Then if exception thrown just log it, and you can also restart your application

private static void OnCurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
#if DEBUG
    System.Diagnostics.Debugger.Break();//we will break here if we are in debug mode.
#endif//DEBUG

    LogException(e);//maybe send email to you also.
    RestartTheApplication();    
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文