在Windows 7中运行C#应用程序时出现错误消息,该应用程序以前在Windows Vista下运行

时间:2011-06-29 09:08:28

标签: c# .net winforms exception-handling

这种错误信息是什么意思? 我有一个C#表单应用程序,它在Windows Vista下编译得很好,当我尝试在Windows 7下运行它时,我收到以下消息。有什么原因导致这个? 我使用Visual Studio 2008开发此应用程序

Description:    
  Stopped working

Problem signature:    
  Problem Event Name:   CLR20r3    
  Problem Signature 01: matrium.exe    
  Problem Signature 02: 1.0.0.0    
  Problem Signature 03: 4e0c494c    
  Problem Signature 04: System    
  Problem Signature 05: 2.0.0.0    
  Problem Signature 06: 4a275e22    
  Problem Signature 07: 3a97    
  Problem Signature 08: 394    
  Problem Signature 09: System.ComponentModel.Win32    
  Locale ID:    10313

1 个答案:

答案 0 :(得分:1)

CLR20r3是一个非常通用的错误消息,并没有真正告诉我们有什么可能出错的地方。

这里最好的选择是挂钩AppDomain未处理的异常事件,看看发生了什么:

AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HandlerMethod);

void HandlerMethod(object sender, UnhandledExceptionEventArgs e)
{
    if ((args.ExceptionObject is ThreadAbortException) != true)
    {
        var exception = args.ExceptionObject as Exception;
        MessageBox.Show(exception.ToString());
    }
}