Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 缺少堆栈跟踪信息_Asp.net_Vb.net_Exception - Fatal编程技术网

Asp.net 缺少堆栈跟踪信息

Asp.net 缺少堆栈跟踪信息,asp.net,vb.net,exception,Asp.net,Vb.net,Exception,我似乎从堆栈跟踪中丢失了一些信息,以下是我得到的信息: at Foo.Bar(DataTable table) in D:\Foo\Bar\authoring\App_Code\FooBar.vb:line 87 堆栈跟踪信息的其余部分在哪里 编辑: Web.Config中的自定义错误设置为off,我将在捕获错误的地方处理该错误,如下所示: Catch ex As Exception Respose.Write(ex.StackTrace) End Try 堆栈跟踪仍被截断。请

我似乎从堆栈跟踪中丢失了一些信息,以下是我得到的信息:

at Foo.Bar(DataTable table) in D:\Foo\Bar\authoring\App_Code\FooBar.vb:line 87
堆栈跟踪信息的其余部分在哪里

编辑:

Web.Config中的自定义错误设置为off,我将在捕获错误的地方处理该错误,如下所示:

 Catch ex As Exception
     Respose.Write(ex.StackTrace)
 End Try

堆栈跟踪仍被截断。

请确保在web.config中将customErrors设置为“RemoteOnly”或“Off”,以禁用友好错误

或者堆栈跟踪被重置?(尽管如此,你还是应该看到一些东西)

将重置堆栈跟踪

catch(Exception ex) 
{
   throw ex; 
}
catch(Exception ex) 
{
   throw; 
}
不会重置堆栈跟踪

catch(Exception ex) 
{
   throw ex; 
}
catch(Exception ex) 
{
   throw; 
}
编辑:

获取当前堆栈。堆栈跟踪开始 抛出异常(发生错误)并在捕获异常的当前堆栈帧处结束。因此,它正在反转调用堆栈。由于您正在一发生就写出stacktrace,因此它没有机会在调用堆栈中再进一步

根据你正在做的事情,你可以尝试一些事情

//To just see the stackTrace
Catch ex As Exception
     Throw
 End Try
-获取当前堆栈跟踪信息

//If you are trying to log the stacktrace 
Catch ex As Exception
     Respose.Write(Environment.StackTrace)
     Respose.Write(ex.StackTrace)
 End Try

//If is hiding then try - hiding as in throw ex vs just throw
Catch ex As Exception
     //careful innerException can be null
     //so need to check before using it
     Respose.Write(ex.InnerException)
 End Try

其中一种方法应该适合您。

感谢您的回复,有关详细信息,请参阅我的编辑。非常感谢你能给我的任何帮助。