Debugger showing wrong values for enum

  • Thread starter Thread starter Joanna Carter [TeamB]
  • Start date Start date
J

Joanna Carter [TeamB]

Hi folks

If I write a KeyDown handler and check the KeyCode for Keys.Insert, the
debugger shows the value as Keys.LButton | Keys.MButton | Keys Back |
Keys.Space.

This is perfectly understandable since Keys.Insert = 45 and 1 + 4 + 8 + 32
also equals 45. However, it would be really nice if the debugger showed both
the combined value as well as the Flags attribute split value.

Is there any way to change the debugger view, or is this something that
needs fixing in an update ?

Joanna
 
Hi Joanna,

I believe the debugger is simply displaying the result of Enum.ToString(). Try eKeys.ToString("G") to display the named constant
with the current value.

In VS.NET 2005 a visualizer can display both the constant and flag values as you requested. Unfortunately, you have to write it ;)

Visualizers in VS.NET 2005 on MSDN:
http://msdn2.microsoft.com/en-us/library/zayyhzts.aspx
 
"Dave Sexton" <dave@jwa[remove.this]online.com> a écrit dans le message de
news: (e-mail address removed)...

| Hi Joanna,
|
| I believe the debugger is simply displaying the result of Enum.ToString().
Try eKeys.ToString("G") to display the named constant
| with the current value.
|
| In VS.NET 2005 a visualizer can display both the constant and flag values
as you requested. Unfortunately, you have to write it ;)
|
| Visualizers in VS.NET 2005 on MSDN:
| http://msdn2.microsoft.com/en-us/library/zayyhzts.aspx

Hmmm, I think that will have to take a back shelf for now, I will play with
that when I get more free time :-)

Thanks for the link to the tutorial.

Joanna
 
Back
Top