Debugging Issue

G

Guest

Hi I'm new to c# and .net from a vb6 background and i'm having issues with
the debugging of applications

I am trying to create a watch on an expression
aString.IndexOf(",",0).ToString()
but either in the watch window or the immediate window I get an out of scope
Error

however if the program runs through it returns a value.

Has anyone got an idea of what I am doing wrong
 
G

Guest

Hi PeteMc,

The debugger windows need to be in the same scope of the variable where it
is declared to work. So, put a breakpoint within this scope and try.

HTH,
Rakesh Rajan
 
G

Guest

this is a very simple example of what is happening when I use a breakpoint on
the
textBox1.Text = aString.IndexOf(",",0).ToString(); Line


private void button1_Click(object sender, System.EventArgs e)
{
string aString;

aString = "Testing Index of, In a Watch";
textBox1.Text = aString.IndexOf(",",0).ToString();

}



putting a watch on the aString.IndexOf(",",0).ToString()

returns the following in the watch window while in breakmode

aString.IndexOf(",",0).ToString() error: 'aString.IndexOf' does not exist
cheers
PeteMc
 
G

Guest

Hi Pete,

Put a breakpoint in the aString line. Check whether the watch is still
showing the same message.

HTH,
Rakesh Rajan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top