我无法获取旧的VS2008 ExpressionTree deubgger可视化示例,该示例可在此处获取:http://code.msdn.microsoft.com/Visual-Studio-2008-C-d295cdba
使用VS2010。
我知道该示例是为旧版本的.NET构建的,因此需要使用最新的VS2010 DebuggerVisualizers.dll重新编译。
所以这就是我所做的
将ExpressionTreeVisualizer.dll复制到以下位置
... \ Documents \ Visual Studio 2010 \ Visualizers ... \ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ Packages \ Debugger \ Visualizers
但我根本看不到VS2010中的调试器可视化器。
任何人都知道我做错了什么
答案 0 :(得分:1)
好的,我设法找出这里发生了什么。对于您希望它使用的每种类型,您必须为调试器可视化器添加单独的程序集级别属性。
不幸的是,通过遍历继承树,它似乎不够聪明。所以我做了一切但是修改了源代码,在示例代码中的“ExpressionTreeVisualizer”类中包含了以下属性
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(Expression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(BinaryExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(BlockExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(ConditionalExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(ConstantExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(DebugInfoExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(DefaultExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(DynamicExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(GotoExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(IndexExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(InvocationExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(LabelExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(LambdaExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(ListInitExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(LoopExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(MemberExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(MemberInitExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(MethodCallExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(NewArrayExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(NewExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(ParameterExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(RuntimeVariablesExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(SwitchExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(TryExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(TypeBinaryExpression), Description = "Expression Tree Visualizer")]
[assembly: DebuggerVisualizer(typeof(ExpressionTreeVisualizerForVisualStudio2010), typeof(ExpressionTreeVisualizerObjectSource),
Target = typeof(UnaryExpression), Description = "Expression Tree Visualizer")]