Line numbers and VB.NET 
Author Message
 Line numbers and VB.NET

I'm looking at using the line number option in VB.NET so as to better
determine the source of errors. Since I want to use structured error
handling I'd need to use the StackTrace property like this:

        Catch ex As Exception

            MsgBox(ex.StackTrace)

        End Try

to find out exactly what procedure and line # caused the problem.
Since production builds do not offer lines #s, I'd need to compile as
a debug version in order to have this feature and ship the PDB file
along with the app. My question is: Has anyone every tried this
successfully? What kind of performance issues are there? Are these any
other issues with this approach or alternatives that I could use
(other than unstructured error handling)?

Thanks

Carl



Mon, 23 May 2005 03:32:06 GMT  
 Line numbers and VB.NET
Hi Carl,

Enabling debug tracking (by producing a PDB file) lowers performance a
little (I've never been able to see the difference), while disabling code
optimization can lower performance quite a lot. However, I've also seen
examples where code optimization has *decreased* performance.

You can change the release configuration (rather than use the debug
configuration) to produce a PDB file while still keeping the setting that
says optimize the code. Then the released program will produce line numbers,
although optimization can occasionally play some funny games with the line
numbers. I've used this, and never found any problems with it.

Here's a cool trick. Create a file in your application folder called
MyApp.ini (where MyApp is your app name). This ini file can tell the JIT
compiler how to do its JIT compilation, regardless of how the language
compilation was performed. The settings look like this, where 1=true and
0=false:

[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0

As long as you ship a matching PDB file, this allows you to decide on your
app's optimization and debug tracking at run-time rather than compile-time.

<plug>
This all comes from part of my upcoming book "Comprehensive VB .NET
Debugging".
</plug>

Regards,

Mark


I'm looking at using the line number option in VB.NET so as to better
determine the source of errors. Since I want to use structured error
handling I'd need to use the StackTrace property like this:

        Catch ex As Exception

            MsgBox(ex.StackTrace)

        End Try

to find out exactly what procedure and line # caused the problem.
Since production builds do not offer lines #s, I'd need to compile as
a debug version in order to have this feature and ship the PDB file
along with the app. My question is: Has anyone every tried this
successfully? What kind of performance issues are there? Are these any
other issues with this approach or alternatives that I could use
(other than unstructured error handling)?

Thanks

Carl



Mon, 23 May 2005 03:48:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. PBM: Line numbers used by Goto method do not reflect displayed line numbers in document

2. Line numbers into multi-line text box

3. Word '97 Line Number in VB 6.0

4. LINE NUMBERING IN VB

5. Word '97 Line Number from VB 6.0

6. Need tool to add line numbers to vb source

7. Numbering VB code lines

8. VB editor line number

9. Line Numbers in VB IDE

10. VB and Line Numbers

11. VB Line Numbers

12. Line Numbers in VB

 

 
Powered by phpBB® Forum Software