Visual Studio: Make debugger aware that a function doesn't cause "side effects"

c#, debugging, visual-studio

Solution

You can append `,ac` to the watch expression to have it automatically refresh the value:

x.ToString(),ac

See MSDN for more information and other format specifiers.

Problem

I have an object i have to watch a function output of pretty many times through the watch window. The problem is that i have to press the refresh button every time i step because "this expression causes side effects and will not be evaluated". Is there any way to tag a function with something like [DoesNotCauseSideEffects] so the watch automatically can evaluate it every time i make a step? I'm coding C# in VS2008 or 2010. Edit: The function looks like this and does, as you can see, not cause any side effects.(x,y,z are all doubles) ``` public override string ToString() { return "{ " + x.ToString(".00") + ", " + y.ToString(".00") + ", " + z.ToString(".00") + "}"; } ```

Original source