for循环后的代码在vb.net中不执行怎么解决?

How to solve codes after for loop that do not execute in vb.net?

我的form_load

下有这个代码
    checkUser = False
    MsgBox("test start")
    result = Newtonsoft.Json.JsonConvert.DeserializeObject(Of ArrayList)(getJSon("https://dtitdtr.herokuapp.com/employees"))
    MsgBox("test after result before for-each")
    For Each value As Object In result
        token = JObject.Parse(value.ToString())
        id = token.SelectToken("id")
        fname = token.SelectToken("fname")
        mname = token.SelectToken("mname")
        lname = token.SelectToken("lname")
        contact = token.SelectToken("contactno")
        add = token.SelectToken("address")
        user = token.SelectToken("username")
        pass = token.SeelectToken("password")
        If user.ToString().ToUpper().Equals(GetUName()) Then
            checkUser = True
            Exit For
        Else
            checkUser = False
        End If
    Next value
    MsgBox("test after next value")
    reader.Close()
    response.Close()

并且当我 运行 程序时,前两 (2) 个消息框显示,最后一个(在下一个值之后)不会显示。

我不太明白发生了什么;从昨天开始,当我 运行 它时,它运行得很好,现在在为 更新信息 添加代码后,这不会影响 form_load,for循环后面的代码不会执行。这有什么问题?

我有一些 here"an exception is being thrown" 但我的代码中甚至没有 Try Catch。

希望您的代码在 For 中抛出一些 Exception,所以我建议您包含 Try.. Catch 以获取异常详细信息。帮助您发现问题。

        Try
            For Each value As Object In result
                token = JObject.Parse(value.ToString())
                id = token.SelectToken("id")
                fname = token.SelectToken("fname")
                mname = token.SelectToken("mname")
                lname = token.SelectToken("lname")
                contact = token.SelectToken("contactno")
                add = token.SelectToken("address")
                user = token.SelectToken("username")
                pass = token.SeelectToken("password")
                If user.ToString().ToUpper().Equals(GetUName()) Then
                    checkUser = True
                    Exit For
                Else
                    checkUser = False
                End If
            Next value
            MsgBox("test after next value")
            reader.Close()
            response.Close()
        Catch ex As Exception
            MsgBox("Exception :" & ex.ToString)
        End Try