views:

31

answers:

2

I am trying to align some data in a c# struct that was created in c++. I know I'm a couple of bytes off, but I can't tell where becuase VS organizes the members in alphabetical order, rather than the order the occur in the struct (which is defined explicitly).

Is it possible to change the order of the display of members in the debug dialog that shows the struct's values?

A: 

Open up your binary in cdb (from the Debugging Tools for Windows) via this command:

cdb -z \path\to\your\yourlibrary.dll

then run

dt yourlibrary!NameOfYourStruct

This will tell you exactly how the structure is laid out.

Paul Betts
A: 

Maybe you could use a clever DebuggerDisplay attribute for your struct.

Josef
I found what I needed without having to use this, but it looks like a neat technique!
scottm