debugger bug?
-
look at this little application
using System; namespace ConsoleApplication2 { class Class1 { enum Test : byte { zero = 0x00, foo = 0x7F, middle = 0x80, max = 0xFF } [STAThread] static void Main(string[] args) { Test test; test = Test.zero; Console.WriteLine("{0}",test); test = Test.foo; Console.WriteLine("{0}",test); test = Test.middle; Console.WriteLine("{0}",test); test = Test.max; Console.WriteLine("{0}",test); } } }
running that writes the correct values to the console, but if you debug the main-function step by step, you realize, that first the debugger shows the value oftest
as 'zero' and 'foo', but middle and max are shown as '-128' and '-1'. :wtf: seems to me, the debugger assumes, all enums are based on signed types (which byte is obviously not). was really confusing to me... :| :wq