使用 .NET 应用程序时出现奇怪的错误消息

使用 .NET 应用程序时出现奇怪的错误消息

几天前我安装了 XNA 框架后,最近出现了许多错误消息。应用程序仍在运行,其中一些应用程序不受这些错误的困扰,但其他应用程序在执行应用程序内的功能时将无法运行/收到此错误消息。

以下是错误信息:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at Windows_Theme_Installer.Main.bApplyTheme_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5466 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
Windows Theme Installer
    Assembly Version: 1.0.0.0
    Win32 Version: 
    CodeBase: file:///C:/Users/Ben/Documents/deskmod%20tools/Windows%20Theme%20Installer/Windows%20Theme%20Installer%20v%201.1.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

**编辑:**我解决了这个问题;事实证明,我尝试使用的应用程序由于某种原因需要管理员权限,尽管它们之前根本不需要这个权限。

答案1

每当 .NET 应用程序中出现未处理的异常,并且应用程序或机器管理员(如 Windbg 或 Visual Studio)没有定义默认处理程序时,.NET 未处理的异常处理程序就会处理该异常并向用户显示一个消息框询问是否继续或终止。

如果用户选择忽略,应用程序可能会或可能不会正常工作。您需要设置一个调试器(如 Visual Studio 或 WinDbg)并进行转储或实时调试,找出到底发生了什么变化。

调用堆栈显示异常发生在名为以下内​​容的自定义类中:

Windows_Theme_Installer.Main.bApplyTheme_Click
  1. 此外,安装 XNA 框架可能会暴露 .NET Framework 中的错误。因此,要验证这一点,只需运行 Windows 更新并查看是否修复了该问题。

  2. 否则,XNA 可能安装了框架的更新版本,而该更新版本现在暴露了代码中的缺陷。调试是唯一的解决方案。

  3. 您的 RAM 或硬盘有坏扇区的可能性非常小。这可能会导致随机崩溃。但是,它会在随机应用程序中表现出来,而不是在特定应用程序中表现出来。运行 fdisk 检查您的硬盘,运行 memtest86 测试您的 RAM。

相关内容