Results 1 to 4 of 4

Thread: VS 2013 Express — How to see line number of error

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2014
    Posts
    3

    VS 2013 Express — How to see line number of error

    For a beta release, I'd like to deploy my VS 2013 Express app with some debugging enabled. What do I need to enable to be able to see the line number that an error occurred on?

    I noticed that VS Express doesn't support JIT. Does that mean I'm out of luck?

    Thanks...

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,347

    Re: VS 2013 Express — How to see line number of error

    Build your project under the Debug configuration and deploy the PDB files with the EXE/DLL files. The stack trace of an exception will then contain line numbers. You can call ToString on any exception to get the message and the stack trace in a single String.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2014
    Posts
    3

    Re: VS 2013 Express — How to see line number of error

    Thanks...

  4. #4
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,837

    Re: VS 2013 Express — How to see line number of error

    Here is an example of one I use. I have line numbers in IDE turned on but they don't show here. Just trust me that line number 14 is "y = y / 0"

    Code:
    Public Class Form1
    
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    
        Dim x As Integer
        Dim y As Integer = 0
    
        Try
            x = x + 1
            x = x + 1
            x = x + 1
            x = x + 1
            x = x + 1
            y = y / 0
            x = x + 1
            x = x + 1
            x = x + 1
        Catch ex As Exception
                Dim trace = New System.Diagnostics.StackTrace(ex, True)
                MessageBox.Show(ex.Message & vbCrLf & "Button1_Click - Line number:" & trace.GetFrame(0).GetFileLineNumber().ToString)
                Exit Sub
        End Try
    
    
    End Sub
    End Class
    Attached Images Attached Images  
    Please remember next time...elections matter!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width