vb.net调试器跳过线调试 [英] vb.net debugger skips line for debugging

查看:150
本文介绍了vb.net调试器跳过线调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天早些时候,我问在vb.net这个问题调试器跳过线但我只是发现了一些奇怪的(或者说是正常的vb.net)有关我工作的项目。
我编辑VB文件,增加了一些方法。
调试原始文件工作正常,我可以步入code和经过的每一行,一行行,没有任何问题。
现在,当我加了一些方法调试工作确实很奇怪,检查这两个截图:

Earlier today I asked this question debugger in vb.net skips line but I just found out something weird (or maybe that's normal for vb.net) about the project I am working on. I am editing vb file, adding some methods. Debugging the original file is working fine, I can step into the code and go through each line, line by line, without any problems. Now when I added a few methods debugger works really weird, check these two screenshots:


  1. 网站未启动 - >在地方所有断点: http://gyazo.com/ 1077b7efbdb2b37174d5960cdff0bda5.png?1348160907

网站开始 - >断点二号线丢失: http://gyazo.com /3051303d6eb27af9ea13bd6e72b81a83.png?1348161507

website is started -> breakpoint at 2nd line is missing: http://gyazo.com/3051303d6eb27af9ea13bd6e72b81a83.png?1348161507

此外,当我添加方法的文件,现在调试不走逐行,但在一号线为例步骤,然后当我点击F10,它下面更进一步20行,这不是'T去在code中的下一行。
我编辑vb.net code为第一次,我一直在使用C#专用的,我不知道如果我需要编辑该文件后,修改的东西,这样调试器将正常工作。

Furthermore, when I added the methods to the file, now the debugging doesn't go line by line, but for example steps at the 1st line, and then when I click f10, it goes 20 lines further below, it doesn't go to the next line in the code. I am editing vb.net code for first time, I've been using c# exclusively, and I don't know if I need to modify something after editing the file so the debugger will work properly.

原来的code:

Public Class Login
    Inherits System.Web.UI.Page

    Private m_objFranchiseInfo As New clsFranchiseInfo

    Private Sub Login_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Dim sEmail As String = Request.QueryString("email")
        Dim sPswd As String = Request.QueryString("password")



        If (Not String.IsNullOrWhiteSpace(sEmail) And Not String.IsNullOrWhiteSpace(sPswd)) Then

            If (sEmail.ToLower = "admin@mysite.com") Then
                FormsAuthentication.SetAuthCookie(sEmail, False)
                Session("UserName") = sEmail
                Session("Password") = sPswd
            Else

                Dim objService As New clsPropertyware
                With objService

                    .UserName = sEmail
                    .Password = sPswd
                    .Initialize()

                    If .TestConnection = True Then
                        FormsAuthentication.SetAuthCookie(sEmail, False)
                        Session("UserName") = sEmail.ToLower
                        Session("Password") = sPswd
                        Session("OrgID") = .GetOrgID


                    Else
                        FormsAuthentication.SetAuthCookie("", True)
                        Session("UserName") = String.Empty
                        Session("Password") = String.Empty
                        Session("OrgID") = String.Empty
                    End If

                End With


            End If
        Else
            FormsAuthentication.SignOut()
            Session("UserName") = String.Empty
            Session("Password") = String.Empty
            Session("OrgID") = String.Empty
        End If
    End Sub



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim sEmail As String = Request.QueryString("email")
        Dim sPswd As String = Request.QueryString("password")

        If (Not String.IsNullOrWhiteSpace(sEmail) And Not String.IsNullOrWhiteSpace(sPswd)) Then

            If (sEmail.ToLower = "admin@mysite.com") Then
                FormsAuthentication.SetAuthCookie(sEmail, False)
                Session("UserName") = sEmail
                Session("Password") = sPswd
            Else

                Dim objService As New clsPropertyware
                With objService

                    .UserName = sEmail
                    .Password = sPswd
                    .Initialize()

                    If .TestConnection = True Then
                        FormsAuthentication.SetAuthCookie(sEmail, False)
                        Session("UserName") = sEmail.ToLower
                        Session("Password") = sPswd
                        Session("OrgID") = .GetOrgID
                        Response.Redirect("~/default.aspx")
                    Else
                        FormsAuthentication.SetAuthCookie("", True)
                        Session("UserName") = String.Empty
                        Session("Password") = String.Empty
                        Session("OrgID") = String.Empty
                    End If

                End With


            End If
        Else
            FormsAuthentication.SignOut()
            Session("UserName") = String.Empty
            Session("Password") = String.Empty
            Session("OrgID") = String.Empty
        End If
    End Sub



    Private Sub LoginUser_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles LoginUser.Authenticate

        Dim szUserName As String = CType(LoginUser.FindControl("UserName"), TextBox).Text().Trim()
        Dim szPassword As String = CType(LoginUser.FindControl("Password"), TextBox).Text().Trim()

        If (szUserName.ToLower = "admin@mysite.com") Then
            e.Authenticated = True
            Session("UserName") = szUserName
            Session("Password") = szPassword
        Else

            Dim objService As New clsPropertyware
            With objService

                .UserName = szUserName
                .Password = szPassword
                .Initialize()

                If .TestConnection = True Then
                    e.Authenticated = True
                    Session("UserName") = szUserName.ToLower
                    Session("Password") = szPassword
                    Session("OrgID") = .GetOrgID
                Else
                    e.Authenticated = False
                    Session("UserName") = String.Empty
                    Session("Password") = String.Empty
                    Session("OrgID") = String.Empty
                End If

            End With
        End If

    End Sub


    Private Sub LoginUser_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoginUser.LoggedIn

        If (Session("UserName") = "admin@mysite.com") Then
            Response.Redirect("~/UploadValues.aspx")
        Else

            m_objFranchiseInfo.Clear()
            If (m_objFranchiseInfo.Load(Session("UserName")) = True) Then
                Session("FranchiseAgent") = m_objFranchiseInfo.szAgent
                Session("FranchiseAgent2") = m_objFranchiseInfo.szAgent2
                Session("FranchiseAddress") = m_objFranchiseInfo.szAddress
                Session("FranchiseCity") = m_objFranchiseInfo.szCity
                Session("FranchiseState") = m_objFranchiseInfo.szState
                Session("FranchiseZip") = m_objFranchiseInfo.szZip
                Session("FranchisePhone") = m_objFranchiseInfo.szPhone
                Session("FranchiseFax") = m_objFranchiseInfo.szFax
                Session("FranchiseEmail") = m_objFranchiseInfo.szEmail
            Else
                Response.Redirect("~\FranchiseInfo.aspx")
            End If
        End If

    End Sub
End Class

修改code:

Imports System.Security.Cryptography

Public Class Login
    Inherits System.Web.UI.Page

    Private m_objFranchiseInfo As New clsFranchiseInfo

    Private Sub Login_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Dim sEmail As String = Request.QueryString("email")
        Dim sPswd As String = Request.QueryString("password")



        If (Not String.IsNullOrWhiteSpace(sEmail) And Not String.IsNullOrWhiteSpace(sPswd)) Then

            If (sEmail.ToLower = "admin@mysite.com") Then
                FormsAuthentication.SetAuthCookie(sEmail, False)
                Session("UserName") = sEmail
                Session("Password") = sPswd
            Else

                Dim objService As New clsPropertyware
                With objService

                    .UserName = sEmail
                    .Password = sPswd
                    .Initialize()

                    If .TestConnection = True Then
                        FormsAuthentication.SetAuthCookie(sEmail, False)
                        Session("UserName") = sEmail.ToLower
                        Session("Password") = sPswd
                        Session("OrgID") = .GetOrgID


                    Else
                        FormsAuthentication.SetAuthCookie("", True)
                        Session("UserName") = String.Empty
                        Session("Password") = String.Empty
                        Session("OrgID") = String.Empty
                    End If

                End With


            End If
        Else
            FormsAuthentication.SignOut()
            Session("UserName") = String.Empty
            Session("Password") = String.Empty
            Session("OrgID") = String.Empty
        End If
    End Sub



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim encryptedEmail As String = "myemail@yahoo.com"
        Dim decryptEmail As String = DecryptData("myemail@yahoo.com")
        Dim encrpytedPassword As String = "password"




        Dim sEmail As String = Request.QueryString("email")
        Dim sPswd As String = Request.QueryString("password")

        If (Not String.IsNullOrWhiteSpace(sEmail) And Not String.IsNullOrWhiteSpace(sPswd)) Then

            If (sEmail.ToLower = "admin@mysite.com") Then
                FormsAuthentication.SetAuthCookie(sEmail, False)
                Session("UserName") = sEmail
                Session("Password") = sPswd
            Else

                Dim objService As New clsPropertyware
                With objService

                    .UserName = sEmail
                    .Password = sPswd
                    .Initialize()

                    If .TestConnection = True Then
                        FormsAuthentication.SetAuthCookie(sEmail, False)
                        Session("UserName") = sEmail.ToLower
                        Session("Password") = sPswd
                        Session("OrgID") = .GetOrgID
                        Response.Redirect("~/default.aspx")
                    Else
                        FormsAuthentication.SetAuthCookie("", True)
                        Session("UserName") = String.Empty
                        Session("Password") = String.Empty
                        Session("OrgID") = String.Empty
                    End If

                End With


            End If
        Else
            FormsAuthentication.SignOut()
            Session("UserName") = String.Empty
            Session("Password") = String.Empty
            Session("OrgID") = String.Empty
        End If
    End Sub



    Private Sub LoginUser_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles LoginUser.Authenticate

        Dim szUserName As String = CType(LoginUser.FindControl("UserName"), TextBox).Text().Trim()
        Dim szPassword As String = CType(LoginUser.FindControl("Password"), TextBox).Text().Trim()

        If (szUserName.ToLower = "admin@mysite.com") Then
            e.Authenticated = True
            Session("UserName") = szUserName
            Session("Password") = szPassword
        Else

            Dim objService As New clsPropertyware
            With objService

                .UserName = szUserName
                .Password = szPassword
                .Initialize()

                If .TestConnection = True Then
                    e.Authenticated = True
                    Session("UserName") = szUserName.ToLower
                    Session("Password") = szPassword
                    Session("OrgID") = .GetOrgID
                Else
                    e.Authenticated = False
                    Session("UserName") = String.Empty
                    Session("Password") = String.Empty
                    Session("OrgID") = String.Empty
                End If

            End With
        End If

    End Sub


    Private Sub LoginUser_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoginUser.LoggedIn

        If (Session("UserName") = "admin@mysite.com") Then
            Response.Redirect("~/UploadValues.aspx")
        Else

            m_objFranchiseInfo.Clear()
            If (m_objFranchiseInfo.Load(Session("UserName")) = True) Then
                Session("FranchiseAgent") = m_objFranchiseInfo.szAgent
                Session("FranchiseAgent2") = m_objFranchiseInfo.szAgent2
                Session("FranchiseAddress") = m_objFranchiseInfo.szAddress
                Session("FranchiseCity") = m_objFranchiseInfo.szCity
                Session("FranchiseState") = m_objFranchiseInfo.szState
                Session("FranchiseZip") = m_objFranchiseInfo.szZip
                Session("FranchisePhone") = m_objFranchiseInfo.szPhone
                Session("FranchiseFax") = m_objFranchiseInfo.szFax
                Session("FranchiseEmail") = m_objFranchiseInfo.szEmail
            Else
                Response.Redirect("~\FranchiseInfo.aspx")
            End If
        End If

    End Sub

    Public Function DecryptData(
   ByVal encryptedtext As String) As String

        ' Convert the encrypted text string to a byte array. 
        Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext)

        ' Create the stream. 
        Dim ms As New System.IO.MemoryStream
        ' Create the decoder to write to the stream. 
        Dim decStream As New CryptoStream(ms,
            TripleDES.CreateDecryptor(),
            System.Security.Cryptography.CryptoStreamMode.Write)

        ' Use the crypto stream to write the byte array to the stream.
        decStream.Write(encryptedBytes, 0, encryptedBytes.Length)
        decStream.FlushFinalBlock()

        ' Convert the plaintext stream to a string. 
        Return System.Text.Encoding.Unicode.GetString(ms.ToArray)
    End Function

    Private Function TruncateHash(
    ByVal key As String,
    ByVal length As Integer) As Byte()

        Dim sha1 As New SHA1CryptoServiceProvider

        ' Hash the key. 
        Dim keyBytes() As Byte =
            System.Text.Encoding.Unicode.GetBytes(key)
        Dim hash() As Byte = sha1.ComputeHash(keyBytes)

        ' Truncate or pad the hash. 
        ReDim Preserve hash(length - 1)
        Return hash
    End Function

    Sub New(ByVal key As String)
        ' Initialize the crypto provider.
        TripleDes.Key = TruncateHash(key, TripleDes.KeySize \ 8)
        TripleDes.IV = TruncateHash("", TripleDes.BlockSize \ 8)
    End Sub

    Public Function EncryptData(
    ByVal plaintext As String) As String

        ' Convert the plaintext string to a byte array. 
        Dim plaintextBytes() As Byte =
            System.Text.Encoding.Unicode.GetBytes(plaintext)

        ' Create the stream. 
        Dim ms As New System.IO.MemoryStream
        ' Create the encoder to write to the stream. 
        Dim encStream As New CryptoStream(ms,
            TripleDes.CreateEncryptor(),
            System.Security.Cryptography.CryptoStreamMode.Write)

        ' Use the crypto stream to write the byte array to the stream.
        encStream.Write(plaintextBytes, 0, plaintextBytes.Length)
        encStream.FlushFinalBlock()

        ' Convert the encrypted stream to a printable string. 
        Return Convert.ToBase64String(ms.ToArray)
    End Function

End Class

每一个帮助是值得欢迎的。
由于提前,Laziale

Every help is welcome. Thanks in advance, Laziale

推荐答案

如果您使用的是ASP.net开发服务器托管,我看到时进程仍在执行,尽管Visual Studio中已经停止code这一点。当您启动新的调试会话它试图遵循这两个会议。我认为当你按下停止按钮,而不是关闭浏览器窗口,并有长时间运行或异步进程可能发生这种情况。

If you are hosting using the ASP.net development server, I have seen this happen when that process is still executing code even though Visual Studio has stopped. When you start a new debugging session it tries to follow both sessions. I think this may happen when you hit the stop button rather than closing your browser window and there are long running or asynchronous processes.

尝试在任务栏并选择停止ASP.net开发服务器图标上右击鼠标,然后开始调试。

Try right clicking on the ASP.net development server icon in the taskbar and selecting stop, then start debugging.

这篇关于vb.net调试器跳过线调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆