Incorrect String Debug/Watch Info

O

OvErboRed

It's possible to print out a string's Length property in my code like so:

string asdf = "asdf\0asdf";
Console.WriteLine(asdf); // = "asdf asdf"
Console.WriteLine(asdf.Length); // = 9

However if you try to use the VS.NET debugger's Watch to inspect this,
you'll see that asdf is displayed as "asdf" and asdf.Length is displayed as
4, not 9.

Now I can understand (though not approve of) the IDE's inability to display
the former correctly. However, why doesn't the IDE read from the actual
Length property of the asdf String object (and instead re-calculate the
length on its own)?

And will any of these problems be fixed?
 
J

Jon Skeet

OvErboRed said:
It's possible to print out a string's Length property in my code like so:

string asdf = "asdf\0asdf";
Console.WriteLine(asdf); // = "asdf asdf"
Console.WriteLine(asdf.Length); // = 9

However if you try to use the VS.NET debugger's Watch to inspect this,
you'll see that asdf is displayed as "asdf" and asdf.Length is displayed as
4, not 9.

Now I can understand (though not approve of) the IDE's inability to display
the former correctly. However, why doesn't the IDE read from the actual
Length property of the asdf String object (and instead re-calculate the
length on its own)?

And will any of these problems be fixed?

I thought these problems were fixed in VS.NET 2003 - which version are
you using?
 
O

OvErboRed

I'm using the original VS.NET. Is there an (official) comprehensive list of
bugs found/fixed anywhere?
 
J

Jon Skeet

OvErboRed said:
I'm using the original VS.NET. Is there an (official) comprehensive list of
bugs found/fixed anywhere?

Not that I've seen, I'm afraid - although that doesn't mean there isn't
one somewhere.
 

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