好的,我设法找出这里发生了什么。也就是说,您必须为您希望使用的每种类型的调试器可视化工具放置一个单独的程序集级属性。
不幸的是,它似乎不够聪明,无法通过遍历继承树来知道这一点。所以我做了一切,但修改了源代码以在示例代码中的类“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")]