Why does a watch or quick watch on string.SubString() not work in VS.Net 2003

I an using ASP.Net with C# codebehind. I have the following code behind an aspx Page. The code runs successfully.
private void Button1_Click(object sender, System.EventArgs e)
{
      string a;
      string b;
      a = "abcdefghijklmnopqrstuvwxyz";
      b = a.Substring(2); //breakpoint on this line
}

My issue is that when I try to look at the value of a.Substring(2) in the IDE while debuging.

I have a breakpoint set at 'b = a.Substring(2)'. If i try ?a in the immediate window or put a watch on a i get "abcdefghijklmnopqrstuvwxyz" as expected. If i do the same with b I get null as expected. If I try ?a.Substring(2) in the immediate window or put a watch on a.Substring(2) I expect to receive "cdefghijklmnopqrstuvwxyz", however I get an error - "error: 'a.Substring' does not exist"

I have tried the same code in vb code behind and the IDE works as expected!

Why can I not check the value or variable.SubString() in the IDE for C# code?
I am looking for a definitive reason why?

LVL 5
stumpy1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mmarinovCommented:
Hi stumpy1,

try to put a.SubString(2) not a.Substring(2) :) c# is case sensitive

Regards!
B..M
mmarinov
0
stumpy1Author Commented:
Its not a code sensitivity thing. The code compiles and runs perfectly, 'does exactly as i says on the tin'.
The code would throw compile error otherwise. It actually throws a compile error if you try a.SubString(2);

Its when I try and view what the result of a.Substring(2) is going to be, through the immediate window or through a watch that it refused with the error message.

Its definatly 1 of those niggling problems. As I said, the code runs properly, I just want to try and figure out why the IDE wont les me watch the expression
0
stumpy1Author Commented:
I have the same problems with several other functions

?a.ToLower() returns
error: 'a.ToLower' does not exist

?a.ToString() returns
error: 'a.ToString' does not exist

etc. etc. I am using Visual Stidio Architect Edition 2003.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

stumpy1Author Commented:
mmaronov, thanks for your suggestion. I think I will probably have to delete this question. I am going to leave it open for another while to see if I get any other input.
I will post another comment before I delete anyway.
0
mmarinovCommented:
stumpy1,

i've tried a lot of times and ways and can not come with clear solution
the easy way ( but just for debuging ) is to use another variable - i know it sounds crazy but if you want to check your code - this is a solution

also, very sorry for the big delay

B..M
mmarinov

P.S.: i'm ok with closing the question. no problems
0
stumpy1Author Commented:
mmarinov,
No probs. This question is more out of curiousity than anything else. I have workarounds for it already, its just 1 of those things that eats away at my curiousity.

The really odd thing is that the watch/immediate window works for VB.Net code but not for C#.Net code inside the VS IDE.

Thinking about it again, It must be a limitation of the C# compiler or something like that.

Im going to leave the question open for another while anyway, Will probably just get it PAQ'd as opposed to deletion in case anyone else has similar
0
mmarinovCommented:
Yes, it could be that reason
Vb is much on the top than c# :)

B..M
mmarinov
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stumpy1Author Commented:
I posted a 20 point link question in the ASP.Net and .Net TA's to see if someone else has anything else on this topic.
0
mlmccCommented:
I haven't tried this in the environment but I suspect the debugger cannot run the method in question

mlmcc
0
stumpy1Author Commented:
mlmcc,
The debugger can do it with VB.Net code as a watch or in the immediate window but not when its C# code, even if the VB and C# projects are inside the same solution.
0
mlmccCommented:
That may be because VB gets interpreted when run in debug mode while C# is compiled with debug information added.

mlmcc
0
stumpy1Author Commented:
Would you have any links etc. about this difference between how VB.Net and C#.Net are treated in the VS IDE? Currently you cannot make changes on the fly using VB.Net while in run mode but this is going to change with .Net 2.0 and VS 2005.

I have done a bit of searching on the web about this but havent found any explanation *per-say* yet.
0
mlmccCommented:
I don't have any such information.  We are still using VB6 with no intention of moving to the .Net so I haven't done any real research except what I read here.

mlmcc
0
stumpy1Author Commented:

I am tempted to post a new link in the ASP.Net TA and up the points to see if I can generate some more information about this, there must be someone in this forum that knows the definitive answer to this
or
should I just PAQ the Q?
0
mlmccCommented:
Just be careful of the 500 point max on a question or group of the same question.

mlmcc
0
stumpy1Author Commented:
I posted a new pointer link in the ASP.Net TA. I will probably just leave this open for another few days to see if anyone more feedback and then PAQ it for future reference.
0
stumpy1Author Commented:
I found a little snippet on http://weblogs.asp.net/andypennell/archive/2004/02/03/66949.aspx that may be related,
Andy Pennell stated: The VS 2003 C# EE does not allow you to call methods on primitive types (eg string). We fixed it in VS "Whidbey".

I cant believe there isnt an easily found answer for this out there, amazing!
0
stumpy1Author Commented:
I found another mention by Craig Neable
at http://msdn.microsoft.com/chats/transcripts/mobileembedded/embedded_041703.aspx

From the page:
Host: Craig (Microsoft)
Q: Some function like String.SubString() does not work in immediate window during debug time in NETCF, is it a known bug?
A: Not that we know of, but we always love to hear about things we can fix...:-)

0
stumpy1Author Commented:
I posted a question on a different forum to see if I would get any feedback but alas, nothing so far. I will keep posted
0
stumpy1Author Commented:
Im closing out this question as it seems that the information is unavailable anywhere I look, its almost like theres a conspiricy theory trying to cover up the fact that the problem exists....

Sorry about the B, just didnt get definitive answer/reason
Thanks for your input all the same......
0
mlmccCommented:
Glad i could help

mlmcc
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.