使用“开始调试”和“无需调试启动”启动应用程序时的不同堆栈跟踪

时间:2014-09-30 16:47:53

标签: c# .net vb.net debugging

我在VS2013中获得了不同的堆栈跟踪" DEBUG - >开始调试"和" DEBUG - >启动时无需调试"。似乎外部异常正在被删除。

这是我做的事情" DEBUG - >开始调试" (注意外部异常):

EmgNet.Exceptions.SQLExecutionException: Incorrect syntax near 'Heights_xlsx'.
Failed while executing: 'IF OBJECT_ID('tempdb..#mapping_Heights_xlsx') IS NOT NULL DROP TABLE #mapping_Heights_xlsx' ---> System.Data.SqlClient.SqlException: Incorrect syntax near 'Heights_xlsx'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)
   at EmgNet.DataLib.ExecSql(String SqlText, IDbConnection& Connection, Int32 CommandTimeout, IDbTransaction& Transaction, String MultipleRowSeparator, Object FieldNames, SqlExecType ExecType) in C:\DevHome\TFS\Projects\DataLib.vb:line 4181
   --- End of inner exception stack trace ---
   at EmgNet.DataLib.ExecSql(String SqlText, IDbConnection& Connection, Int32 CommandTimeout, IDbTransaction& Transaction, String MultipleRowSeparator, Object FieldNames, SqlExecType ExecType) in C:\DevHome\TFS\Projects\DataLib.vb:line 4207
   at EmgNet.DataHandler.ExecSql(String SqlText, IDbConnection& Connection, Int32 CommandTimeout, IDbTransaction& Transaction, String MultipleRowSeparator, Object FieldNames, SqlExecType ExecType) in C:\DevHome\TFS\Projects\DataHandler.vb:line 1248
   at EmgNetExt.SimpleFileImporterMapper.LoadFileInternal(String file) in C:\DevHome\TFS\Projects\DataLoaderWithMapper\SimpleFileImporterMapper.vb:line 36
   at EmgNetExt.AFileImporterMapper.LoadFile(String file) in C:\DevHome\TFS\Projects\DataLoaderWithMapper\AFileImporterMapper.vb:line 19
   at EmgNetExt.frmDataLoaderWithMapper.LoadFile() in C:\DevHome\TFS\Projects\DataLoaderWithMapper\frmDataLoaderWithMapper.vb:line 130
   at EmgNetExt.frmDataLoaderWithMapper.frmDynamicDataLoader_Shown(Object sender, EventArgs e) in C:\DevHome\TFS\Projects\DataLoaderWithMapper\frmDataLoaderWithMapper.vb:line 55
   at System.Windows.Forms.Form.OnShown(EventArgs e)
   at System.Windows.Forms.Form.CallShownEvent()
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at frmStart.NewImportToolStripMenuItem_Click(Object sender, EventArgs e) in C:\DevHome\TFS\Projects\frmStart.vb:line 3358
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

这是我做的事情" DEBUG - >开始无需调试" (注意没有外部例外):

System.Data.SqlClient.SqlException: Incorrect syntax near 'Heights_xlsx'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)
   at DataLib.ExecSql(String SqlText, IDbConnection& Connection, Int32 CommandTimeout, IDbTransaction& Transaction, String MultipleRowSeparator, Object FieldNames, SqlExecType ExecType) in C:\DevHome\TFS\Projects\DataLib.vb:line 4181

我很难理解为什么会发生这种情况。为什么在使用调试器运行或在没有调试器的情况下运行时堆栈跟踪会发生变化?

1 个答案:

答案 0 :(得分:0)

在visual studio中,如果你转到菜单Debug - >例外情况,您将看到包含公共语言运行时异常,托管调试助手等异常的表单。根据此设置,通常情况下堆栈跟踪之间的差异来自Visual Studio,它可能会提前中断,或者根本不会中断,只会继续尝试运行。如果你想要更多的细节,那么希望其他人可以回答。我只知道这通常是堆栈跟踪不同的原因。