本文介绍了系统.穿线. ThreadAbortEx ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此代码显示启动画面.但它抛出ThreadabortException.它不会显示stacktrace.请帮助我如何处理此异常.
I am using this code for showing splashscreen. but it throw a ThreadabortException. it does not show stacktrace.Please help me how to handle this exception.
public void splashscreen()
{
Application.Run(new Form13());
}
private void Form1_Load(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(splashscreen));
try
{
t.Start();
Thread.Sleep(500);
t.Abort();
}
catch(Exception e)
{
}
}
例外是:
Exception is:
************** Exception Text **************
System.Threading.ThreadAbortException: Thread was being aborted.
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(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.5456 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
PC PROTECTION PRO
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///F:/19%20oct/14%20sep%20new/PC%20PROTECTION%20PRO/PC%20PROTECTION%20PRO/bin/Debug/PC%20PROTECTION%20PRO.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5460 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5456 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5462 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.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
----------------------------------------
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
----------------------------------------
Interop.Shell32
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///F:/19%20oct/14%20sep%20new/PC%20PROTECTION%20PRO/PC%20PROTECTION%20PRO/bin/Debug/Interop.Shell32.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>
启用JIT调试后,任何未处理的异常
将被发送到计算机上注册的JIT调试器
而不是由此对话框处理.
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.
推荐答案
public void splashscreen()
{
try {
Application.Run(new Form13());
} catch {}
}
Maxim.
Maxim.
这篇关于系统.穿线. ThreadAbortEx ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!