My custom tool window in the Visual Studio Extension package should evaluate custom expressions during debugging sessions for VS2012 and VS2013. The ultimate goal is to create a graphical viewport. Therefore, I should get the value of the result of the expression from the debugging mechanism.
Evaluation works fine through
IDebugStackFrame2 -> IDebugExpressionContext2 -> ParseText
IDebugExpression2 -> EvaluateSync -> IDebugProperty2
The first problem is here: Visual Studio 2013 ParseText()reports errors incorrectly. But the extracted is IDebugProperty2valid (for valid expressions). On VS2012, I get the correct errors for invalid expressions.
This is where the real problem begins. Result Property2 is a complex user object. To visualize it, you need to get a specific property from one of its base classes. In my current attempt, I use IDebugProperty2.EnumChildren()to move through my members to the right place in the class hierarchy, as it would in the Locals window in Visual Studio:
[result] -> base -> Raw -> base -> Non-public Members -> [private field] ... a.s.o.
This somehow works, but introduces the following problems:
Task 1: Get the inner member of some complex object
, EnumChildren(), -, , :
* ? (VS2013 enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_RAW EnumChildren + "Raw View" node, VS2012 , )
* " " node? , - ,
* " " (" , )
*... ?
. ? IDebugProperty3 Visualizer? .
2: VS2012
, IDebugProperty2.GetMemoryBytes() , "" ( System.Array) . VS2013, VS2012 IDebugProperty2.GetMemoryBytes() VS_Constants.S_FALSE. . VS2012 , - ? ?
, API- :
IDebugMemoryContext2 memCtx = null;
IDebugMemoryBytes2 memBytes = null;
if (tmpProperty2.GetMemoryContext(out memCtx) == VSConstants.S_OK
&& (tmpProperty2.GetMemoryBytes(out memBytes) == VSConstants.S_OK)) {
...
:
OS: Windows 8 and 8.1
Visual Studio: 2012 / 2013
Tool Window built with MPF (C
Debug engines: C