程序莫名其妙就退出,try catch也加了,但是有用,后来在main方法加了未捕获异常的处理代码。
下面是异常信息,我的程序用到了第三方API,帮忙分析下下面是什么错误。
在 System.AccessViolationException 中第一次偶然出现的“System.Windows.Forms.dll”类型的异常
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>未处理的异常</Description><AppDomain>AttGUI.vshost.exe</AppDomain><Exception><ExceptionType>System.AccessViolationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>尝试读取或写入受保护的内存。这通常指示其他内存已损坏。</Message><StackTrace>   在 System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG&amp;amp; msg, HandleRef hwnd, Int32 msgMin, Int32 msgMax, Int32 remove)
   在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   在 System.Windows.Forms.Application.Run(Form mainForm)
   在 AttGUI.Program.Main() 位置 C:\Documents and Settings\Quan\桌面\资料\考勤系统Source(管理系统+数据收集)\20120813\AttSysManagement\AttSysManagement\AttGUI\Program.cs:行号 24
   在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   在 System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
   在 System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG&amp;amp; msg, HandleRef hwnd, Int32 msgMin, Int32 msgMax, Int32 remove)
   在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   在 System.Windows.Forms.Application.Run(Form mainForm)
   在 AttGUI.Program.Main() 位置 C:\Documents and Settings\Quan\桌面\资料\考勤系统Source(管理系统+数据收集)\20120813\AttSysManagement\AttSysManagement\AttGUI\Program.cs:行号 24
   在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   在 System.Threading.ThreadHelper.ThreadStart()</ExceptionString></Exception></TraceRecord>
在 System.Data.SqlClient.SqlException 中第一次偶然出现的“System.Data.dll”类型的异常
在 System.Data.SqlClient.SqlException 中第一次偶然出现的“DBcon.dll”类型的异常