C# 尝试展开列表中的项时,调试停止<;T>;

C# 尝试展开列表中的项时,调试停止<;T>;,c#,list,generics,visual-studio-debugging,C#,List,Generics,Visual Studio Debugging,出于某种原因,当我尝试展开\u nodeDependencies列表中的每个项目时,它显示有13个项目,但当我开始展开它们时,它表示无法显示内容,并且通常在我单击“多个+”展开列表中的项目后,调试器会停止。我不知道泛型在运行时是如何工作的 public class Tree<T> where T : INode { private readonly IEnumerable<T> _sourceDependencies; private IEnumerab

出于某种原因,当我尝试展开
\u nodeDependencies
列表中的每个项目时,它显示有13个项目,但当我开始展开它们时,它表示无法显示内容,并且通常在我单击“多个+”展开列表中的项目后,调试器会停止。我不知道泛型在运行时是如何工作的

public class Tree<T> where T : INode
{

    private readonly IEnumerable<T> _sourceDependencies;
    private IEnumerable<Node<T>> _nodeDependencies;
    public Node<T> RootNode { get; set; }
    public Dictionary<Node<T>, IList<Node<T>>> FlattenedMap { get; private set; }

    public Tree(T rootNode, IEnumerable<T> dependencies)
    {
        RootNode = new Node<T>(rootNode); 
        _sourceDependencies = dependencies;
    }

    public void BuildTree()
    {
        _nodeDependencies = ConvertDependenciesToNodes(_sourceDependencies);
        AddChildren();
    }

    private IEnumerable<Node<T>> ConvertDependenciesToNodes(IEnumerable<T> listToConvert)
    {
        IEnumerable<Node<T>> nodeList = listToConvert.Select(sourceNode => new Node<T>(sourceNode)).ToList();

        return nodeList;
    }
}
公共类树,其中T:INode
{
私有只读IEnumerable\u sourceDependencies;
私人可数独立;
公共节点RootNode{get;set;}
公共字典展平映射{get;private set;}
公共树(T根节点,IEnumerable依赖项)
{
RootNode=新节点(RootNode);
_sourceDependencies=依赖项;
}
公共void BuildTree()
{
_nodeDependencies=ConvertDependenciesToNodes(_sourceDependencies);
添加儿童();
}
私有IEnumerable ConvertDependenciesToNodes(IEnumerable listToConvert)
{
IEnumerable nodeList=listToConvert.Select(sourceNode=>new Node(sourceNode)).ToList();
返回节点列表;
}
}
这意味着当我将鼠标移到
\u nodeDependencies=ConvertDependenciesToNodes(\u sourceDependencies)

\u nodeDependencies
显示13项,因此我展开列表,然后尝试展开一项或两项,它将停止调试


这与泛型的使用是否有任何关系值得怀疑。正如拉诺金提到的,这很可能是超时的结果

为了创建一个解决方案,您可能会尝试增强您在“监视”窗口中实际监视的内容,以便深入了解

换句话说,不要(或除了)在
\u nodeDependencies
上创建一个手表,而是尝试在
\u nodependencies[0]
上创建一个手表,看看会发生什么。继续此向下钻取过程,直到到达实际要检查的层为止


这可能很有用的原因(特别是在挖掘
IQueryable
数据库结果或在web环境中操作时)与使用IDE单击一系列结果相比,系统自动向下搜索所需的时间要少得多,因此,在任何类型的超时发生之前,您都有更好的机会查看所需内容。

调试器只是停止运行
-不确定您的意思,但如果您是调试iis站点时,它有默认的ping超时90秒,然后停止进程-这看起来像bails)是的,它在其他地方出错,或者像你说的超时,但我通常不会在VS中得到超时。