views:

174

answers:

2

I've programmed in C# for the majority of my .NET career - now I'm working on a VB.net project - when debugging it drives me insane the differences of how the debugging works.

two off the top of my head are

1) having to prefix my immediate window queries with ?

2) not being able to mouse over a GUID, I have to ?myGuid.ToString() to actually see the value

is there a way I can make it behave like C#?

+3  A: 

1 is supported by both VB and C#. When you prefix an immediate window query with ?, you are saying "please evaluate an expression". In the abscence of a ?, anything you will type will be evaluated as a statement. This makes a big difference in the following two lines

? a = b
a = b

The first one is a comparison operation and the second one is an assignment.

As for the second issue. Yes, this is an unfortunate experience for the current version of VS. The next version of VS fixes this problem (and several others in the debugging space).

There is a work around for VS2008 (and likely VS2005) that will allow you to work around the problem. You can add a custom DebuggerDisplay for GUID that invokes .ToString on the object. I wrote up a blog post awhile back on how to achieve this

http://blogs.msdn.com/jaredpar/archive/2007/09/28/customzing-displays-in-the-debugger-for-system-types.aspx

JaredPar
+1  A: 

The ? is a holdover from the original BASIC language where ? was a shortcut for the PRINT statement. I suppose PRINTing the value of a variable is like querying for the results (or asking a question) hence the question mark.

I've been hoping for several versions of Visual Basic that outmoded keywords such as ?, PRINT, and REM would silently fade away, but they haven't... yet.

Jim H.