MCA
MCA

Reputation: 791

Visual Studio 2010 C++ CLR Debugging Windows: How to override 'Value' part?

I did a research on web and cannot find anything so maybe you know a way to solve my problem. I am using MS VS 2010, and I use VS C++ (only CLR).. Let's say I have a class smt like this:

class A
{
public:
int x;
float a;
char* str;
};

While debugging my application, I open "Locals Window" and I see my variable name, value and Type. I would like to change (write) something to my value part. Like I habe a class A object a:

Name          Value                             Type
a             x: 4  a: 2.03f  str: 'Hello!'     A

I hope this was a clear example. I want to override value part in locals, autos ... windows.. Any way to do it?

Thanks...

Upvotes: 0

Views: 412

Answers (1)

Phil Devaney
Phil Devaney

Reputation: 18017

If the class is a managed class then you can decorate it with a DebuggerDisplayAttribute. If it is unmanaged, which your example seems to be, then you need to edit a file called autoexp.dat. There's a fairly old article on MSDN about it here, I have done this a long time ago and remember it was a pain to get working. Also, there is a bug filed on Connect that autoexp.dat doesn't work for C++/CLI projects in VS 2010, though I haven't tried this myself.

Upvotes: 2

Related Questions