1

I have a Visual Studio addin for Visual Studio 2010 which evaluates a number of expressions (including variables in the current stack frame). It is making repeated calls to:

foreach (EnvDTE.Expression expression in dte.Debugger.CurrentStackFrame.Locals)

and

dte.Debugger.GetExpression("CanSerializeToString(" + expression + ")", false);

and

dte.Debugger.GetExpression("SerializeToString(" + expression + ")", false);

where "SerializeToString" methods are defined in the client application being debugged.

I've noticed that the more expressions it evaluates, the slower it gets. When I expanded the contents of an array, I can sit and watch as it takes over a second to evaluate each array element expression, and each one takes longer than the previous.

Is there some kind of cleanup I need to do after evaluating an expression so it doesn't get slower and slower and slower?

Bryce Wagner
  • 1,151
  • 7
  • 18

1 Answers1

0

I know that this isn't directly answering your question but it looks like you are trying to do something very similar to this addin:

https://visualstudiogallery.msdn.microsoft.com/c6a21c68-f815-4895-999f-cd0885d8774f

The strategy I use is I don't have the client code creating the serializer but it's done in the addin code and that runs fairly quickly. It's open source so feel free to take a look.

https://github.com/OmarElabd/ObjectExporter

Omar Elabd
  • 1,914
  • 1
  • 18
  • 23