在以下代码中:
private static void Main(string[] args)
{
var listy = new List<DateTime> { DateTime.Now };
MyMethod(listy);
}
static void MyMethod<T>(List<T> myList)
{
// put breakpoint here
}
Run Code Online (Sandbox Code Playgroud)
如果我打破调试器,在"myList"上打开QuickWatch,我看到:
myList
[0]
Raw View
Run Code Online (Sandbox Code Playgroud)
如果我选择"[0]"节点并单击Add Watch,则添加到Watch的表达式:
(new System.Collections.Generic.Mscorlib_CollectionDebugView<System.DateTime>(myList)).Items[0]
此表达式似乎正确,但是,监视窗口显示以下错误:
'System.Collections.Generic.Mscorlib_CollectionDebugView.Mscorlib_CollectionDebugView(System.Collections.Generic.ICollection)'的最佳重载方法匹配有一些无效的参数
这似乎是调试器中的一个错误.为什么会这样?它是否记录在任何地方?
我有动态字符串显示为MenuItem的标题,有时包含'_'.WPF将下划线视为助记符的标志,但我不希望如此.我如何禁用它?
我们正在尝试在Visual Studio中扩展文本.我们目前的尝试包括在文本的某些点创建透明的intraline装饰品.
我们偶然发现了这种方法的缺点.即,当给定文本附加了背景分类时,分类会中断,结果如下所示:

我们目前正在研究解决这个问题的可能方法:
但是,这两种解决方案看起来都非常糟糕.
解决这个问题的最佳方法是什么?
vsx visual-studio visual-studio-extensions visual-studio-2012 visual-studio-2013
我想使用Roslyn来分析Razor View中一块C#代码的上下文中的语义信息.
有没有办法(在Visual Studio 2015中,甚至在单元测试中)获得SemanticModel代表此代码的代码?
我编写了自己的Debugger Visualizer.
它和属性都在它们自己的程序集中.包含要调试的类的程序集中没有引用或属性 - 我想创建一个可供人们使用的drop-in dll.
我试图调试的类是通用的.
[Serializable]
public class FinCellTable<S> : IFinCellTable, IEnumerable<List<FinCell.IFinCell>>
where S : class, FinCell.IFinHeaderCell, FinCell.IFinCell, new()
Run Code Online (Sandbox Code Playgroud)
这是可视化工具:
[assembly: System.Diagnostics.DebuggerVisualizer(
typeof(Financials.Debugging.CellTableVisualizer),
typeof(VisualizerObjectSource),
Target = typeof(Financials.Transformation.IFinCellTable),
Description = "FinCell Table Visualizer")]
[assembly: System.Diagnostics.DebuggerVisualizer(
typeof(Financials.Debugging.CellTableVisualizer),
typeof(VisualizerObjectSource),
Target = typeof(Financials.Transformation.FinCellTable<Financials.FinCell.FinHeaderCell>),
Description = "FinCell Table Visualizer")]
namespace Financials.Debugging
{
public class CellTableVisualizer : DialogDebuggerVisualizer
{
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
{
if (windowService == null) throw new ArgumentNullException("windowService");
if (objectProvider == null) throw new ArgumentNullException("objectProvider");
var data = …Run Code Online (Sandbox Code Playgroud) 我正在使用Very Sleepy来分析一些C++代码,我注意到在Source视图中,它显示了逐行测量的红色测量值,总是会测量只有方法打开的行或者接近大括号,在某些情况下,与函数中的其他代码行相比,它们相当高.
我最初的假设是显示将方法参数推入堆叠中用于打开大括号的时间,以及为结束大括号弹出堆栈所花费的时间.这是真的?
根据谷歌的外观,似乎这可能是不可能的,但是:
如何在C++/CX'ref类'中定义'out'参数?
如果您的答案是无法做到的,请提供参考.
我想在活动文本视图中更改插入符号位置时收到通知.EnvDTE似乎唯一提供的是LineChanged事件,当在同一行内向左或向右移动插入符号时,当然不会引发该事件.
我意识到VS2010的编辑器扩展性让你可以毫不费力地做到这一点,但我需要一个向后兼容VS2008的解决方案.
给定一个表示特定类/字段/属性的字符串(例如MyNameSpace.MyClass或者System.String.Length),我如何以编程方式使Visual Studio转到该类/字段/属性(即,使Visual Studio做同样的事情,如果我去在代码编辑器中输入引用然后点击F12)?
我正在使用Mono.Cecil 0.9.5.3,并在安装VS2012 RC(导致.NET 4.0 System.XML.DLL被其.NET 4.5版本替换)之后,我在一些迭代的代码中得到一个System.ArugmentException每个方法的自定义属性.看来原因是在某些情况下,AsyncStateMachine属性的ctor参数(应为Type)为空.
下面的代码重现了它:
string path = Assembly.Load("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089").Location;
AssemblyDefinition systemXmlAssembly = AssemblyDefinition.ReadAssembly(path);
var query =
from ModuleDefinition module in systemXmlAssembly.Modules
from TypeDefinition td in module.Types
from MethodDefinition method in td.Methods
from CustomAttribute att in method.CustomAttributes
where method.Name == "System.Xml.IDtdParser.ParseInternalDtdAsync" &&
att.AttributeType.Name == "AsyncStateMachineAttribute"
select att;
CustomAttribute attribute = query.Single();
var args = attribute.ConstructorArguments; // <---- this line throws an ArgumentException
Run Code Online (Sandbox Code Playgroud)
抛出异常
Mono.Cecil.ModuleDefinition.CheckFullName(string fullName = "")
Run Code Online (Sandbox Code Playgroud)
我的问题是 - 这是Mono.Cecil或System.Xml.DLL中的错误吗?规范是否允许"空"类型显示为ctor参数?
c# ×6
vsx ×4
debugging ×2
envdte ×2
async-await ×1
c++ ×1
c++-cx ×1
menuitem ×1
mono.cecil ×1
profiling ×1
roslyn ×1
verysleepy ×1
wpf ×1