How to show the text visualizer for custom classes

Viewed 121

I have builder class that generates a string. The output string is available through the ToString() method. I want to show this output in visual studio's debugger.

When I take a look at the raw string I get the following result:

string

When I look at the builder however it is missing the newlines as well as the "View" button:

MethodScriptBuilder

Adding [DebuggerDisplay("{ToString()}")] to the at least shows the newlines, but still doesn't have the "View" button.

MethodScriptBuilder

How can I make my class automatically display itself exactly like the string, including the "View" button?

1 Answers

Seems like you need to add a DebuggerTypeProxyAttribute to your builder class. It's not very pretty but it sounds like that is what you need.

Here is another SO-question to look at.

Related