Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.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
.net 为什么';我的vb代码不能在stop语句上停止吗?_.net_Vb.net - Fatal编程技术网

.net 为什么';我的vb代码不能在stop语句上停止吗?

.net 为什么';我的vb代码不能在stop语句上停止吗?,.net,vb.net,.net,Vb.net,我正在维护一些VB代码,这些代码似乎不会在stop语句上停止 当我在特定条件下运行程序时,这段代码从最后一行代码中抛出System.Exception(“超时”) 但是如果你一行一行地检查代码,它似乎永远不会碰到这个语句。首先,它尝试返回MyBase.Save。如果不能,那么它将点击stop语句并停止 但看起来程序只是跳过了stop语句 如何调试此代码?具体地说,它如何跳过stop语句以到达抛出新System.Exception(“超时”)的语句 我认为Stop只为调试创建了一个断点 代码将继续

我正在维护一些VB代码,这些代码似乎不会在stop语句上停止

当我在特定条件下运行程序时,这段代码从最后一行代码中抛出System.Exception(“超时”)

但是如果你一行一行地检查代码,它似乎永远不会碰到这个语句。首先,它尝试返回MyBase.Save。如果不能,那么它将点击stop语句并停止

但看起来程序只是跳过了stop语句

如何调试此代码?具体地说,它如何跳过stop语句以到达抛出新System.Exception(“超时”)的语句


我认为Stop只为调试创建了一个断点

代码将继续执行


我认为在返回MyBase.Save时抛出了一个异常。它被捕获到Catch块中,但实际上被该块忽略,因为从未使用过ex。

我认为Stop只为调试创建了一个断点

代码将继续执行


我认为在返回MyBase.Save时抛出了一个异常。它被捕获到Catch块中,但实际上被该块忽略,因为从未使用过ex。

@hatchet您评论中的链接说,当不调试时,Stop的行为类似于End。它终止执行。所以这个答案是错误的。@MarkJ-这是一个很好的观察结果。我想这取决于OP所说的“当我在特定条件下运行程序时”。@hatchet你评论中的链接说,当不调试时,Stop的行为就像End。它终止执行。所以这个答案是错误的。@MarkJ-这是一个很好的观察结果。我想这取决于OP所说的“在特定条件下运行程序时”是什么意思。
Public Overrides Function Save() As Uber

    If IsDeleted AndAlso Not CanDeleteObject() Then
        Throw New System.Security.SecurityException("User is not authorized to remove a Uber")
    ElseIf IsNew AndAlso Not CanAddObject() Then
        Throw New System.Security.SecurityException("User is not authorized to add a Uber")
    ElseIf Not IsNew AndAlso Not CanEditObject() Then
        Throw New System.Security.SecurityException("User is not authorized to update a Uber")
    End If

    Try
        Return MyBase.Save
    Catch ex As Exception

        Stop   //why is the code not stopping here?
    End Try

    Throw New System.Exception("Timed out")  //this line executes, but I don't see how the code gets there

End Function