vb.net debugger - view source

  • Thread starter Thread starter bob lambert
  • Start date Start date
B

bob lambert

Help,

I have vb.net std 2002, have a windows forms app and am
debugging code behind it. I think I am viewing the
source, I set the project to debug (as opposed to
release), I start the debugger, it stops at a breakpoint.

But as I step through, it stops on what appear to be
comment lines. It seems I am not looking at the code
line for line as it is being executed (I expect comments
to be skipped). Cannot figure out how to look at the
real source as it is being executed.

I think it used to work, but now does not seem to. Not
sure what I did ?

Any help would be greatly appreciate.
 
Could you give us some information about how to reproduce your problem?

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit
 
You know what, I think I had another problem that needs
addressing first.

If I am in debug mode, and I select debug/start, will
that not compile and launch debugger ?

I guess I was not really getting the code compiled and it
was using an existing exe.

I selected build solution and no problems apparent in
output, but it was not building what I expected (not
really sure what the heck it was building !) I tried
build and my program name, then it found problems, I
fixed them and when I launch debugger, it looks like its
working ok now.

Wish I knew what the heck I did. What is build solution
compared to build my application name ?


Bob

-----Original Message-----
I will try.

I just have a simple form that does calculations when you
input values and push buttons. One thing I am trying to
do is open and read a file when the form opens. So I
have a Private Sub Form1_Load subroutine. The code looks
like below ...

anyway it seems to go ok walking to the line
RBAirspeedMach.Checked = True

then it walks through some of the comments as if it was
executing them. I notice in the debug window that it is
actually performing the sr.Readline() but the pointer is
on the comment line

' Console.WriteLine("{0} ....

So I cannot really keep track of what line is executing.

Another queer thing. Its just read a line from the file
and displays the line in the debug window, so I think the
sr.Readline() executed. But when I put the mouse over
the variable inputln it shows me

Dim inputln As String

Whats up with that ?


Thanks for any help again

Bob


code snippet


Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim inputln As String
'Dim riou As New Regex("^(?<numrtr>\d+\.\d+[eE]?
[+ -]?(\d+)?.+?<dentr>\d+\.\d+[eE]?\d+[:Wh]+(?
<outunits>.+$", _
' RegexOptions.Compiled)
Dim riou As New Regex("^(?<numrtr>\d+\.\d+[eE]?
[+ -]?(\d+)?.+?<dentr>\d+\.\d+[eE]?\d+[:Wh]+(?
<outunits>.+$")
Dim ipmode As String
Dim count_hi, count_speed, count_alt, count_ram,
count_temp As Integer
Dim units_typ_io_count(4, 2, 0) As Double
' open file if exists, create if not, for
read/write, allow others only read while open
Dim fs As New FileStream(FILE_NAME,
FileMode.OpenOrCreate, FileAccess.ReadWrite,
FileShare.Read)
fs.Close()
Dim sr As New StreamReader(fs)
' set defaults
RBAltitudeFeet.Checked = True
RBAirspeedMach.Checked = True
' overload units conversion file data if it
exists and is readable
' file expected in same dir as where the exe is
located
' should not need snippet below. the fs line
above should create if does
' not exist
' If Not File.Exists(FILE_NAME) Then
' Console.WriteLine("{0} does not exist! Using
Default Units.", FILE_NAME)
' MsgBox(FILE_NAME & " does not exist !")
' GoTo LastLine
' End If
' sr = File.OpenRead(FILE_NAME)
inputln = sr.ReadLine()
While Not inputln Is Nothing
' while not eof - is above appropriate check ?
' end of input stream should return nothing
' but what about a blank line ?
....
-----Original Message-----
Could you give us some information about how to reproduce your problem?

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit





.
.
 
I think you are right when you say you are debugging an older executable
than your current source code.
Check your configurations for a Debug build in the Configuration Manager.

Build --> Configuration Manager --> drop down "Debug" in Active
Configuration and check that each project is set to a Debug build and is
checked to be built.
(I know it seems kind of redundant if you have only one project in the
solution)
 
Hello,

bob said:
You know what, I think I had another problem that needs
addressing first.

If I am in debug mode, and I select debug/start, will
that not compile and launch debugger ?

I guess I was not really getting the code compiled and it
was using an existing exe.

Delete the "bin" and "obj" folders in your project's folder and try again.

Regards,
Herfried K. Wagner
 
To shaynes point, I was configured in debug on all
projects (previous response back to me).

In my project bin folder there is some stuff for line
controls that I added in which were downloaded from the
net. Think I got them from you Herfried. Also, I have
an input file that my program will read in that directory
and its the only copy, so I cannot arbitrarily delete the
directory w/o having other negative consequences. (will
I have to re link the line control stuff ?)

What is your point about removing the folders ? To force
recompile of the target code ? I should only need delete
the exe I would think ?

I guess the real question is I don't understand the
difference between Build/Build Solution, Build/Rebuild
Solution and Build/Build (my project), Build/Rebuild (my
project).

Bob
 
Hello,

bob said:
and its the only copy, so I cannot arbitrarily delete the
directory w/o having other negative consequences. (will
I have to re link the line control stuff ?)

Did you _add_ the Line control project to your solution or did you reference
the DLL? I would suggest to make a backup of both, the obj and the bin
folders and then kill the obj folder and delete the EXE from the bin folder.
After doing that, make a fresh build and try again.

Regards,
Herfried K. Wagner
 
Back
Top