コード例 #1
0
        /// <summary>
        /// Fills node Content property tree.
        /// </summary>
        /// <param name="thisNode"></param>
        private void loadContent(ObjectGraphNode thisNode)
        {
            var contentRoot = new ThisNode();

            thisNode.Content = contentRoot;

            DebugType collectionType;
            DebugType itemType;

            if (thisNode.PermanentReference.Type.ResolveIListImplementation(out collectionType, out itemType))
            {
                //AddRawViewNode(contentRoot, thisNode);
                // it is an IList
                LoadNodeCollectionContent(contentRoot, thisNode.Expression, collectionType);
            }
            else if (thisNode.PermanentReference.Type.ResolveIEnumerableImplementation(out collectionType, out itemType))
            {
                //AddRawViewNode(contentRoot, thisNode);
                // it is an IEnumerable
                DebugType debugListType;
                var       debugListExpression = DebuggerHelpers.CreateDebugListExpression(thisNode.Expression, itemType, out debugListType);
                LoadNodeCollectionContent(contentRoot, debugListExpression, debugListType);
            }
            else
            {
                // it is an object
                LoadNodeObjectContent(contentRoot, thisNode.Expression, thisNode.PermanentReference.Type);
            }
        }
コード例 #2
0
        public void Refresh()
        {
            // clear ListView
            listView.ItemsSource = null;
            ScrollViewer listViewScroller = listView.GetScrollViewer();

            if (listViewScroller != null)
            {
                listViewScroller.ScrollToVerticalOffset(0);
            }
            Value shownValue = null;

            ICSharpCode.NRefactory.Ast.Expression shownExpr = null;
            try     {
                shownExpr  = debuggerService.GetExpression(txtExpression.Text);
                shownValue = shownExpr.Evaluate(debuggerService.DebuggedProcess);
            } catch (GetValueException) {
                // display ex.Message
            }
            if (shownValue != null && !shownValue.IsNull)
            {
                GridValuesProvider gridValuesProvider;
                // Value is IList
                DebugType iListType, listItemType;
                if (shownValue.Type.ResolveIListImplementation(out iListType, out listItemType))
                {
                    gridValuesProvider = CreateListValuesProvider(shownExpr, iListType, listItemType);
                }
                else
                {
                    // Value is IEnumerable
                    DebugType iEnumerableType, itemType;
                    if (shownValue.Type.ResolveIEnumerableImplementation(out iEnumerableType, out itemType))
                    {
                        // original

                        /*var lazyListViewWrapper = new LazyItemsControl<ObjectValue>(this.listView, initialIEnumerableItemsCount);
                         * var enumerableValuesProvider = new EnumerableValuesProvider(val.ExpressionTree, iEnumerableType, itemType);
                         * lazyListViewWrapper.ItemsSource = new VirtualizingIEnumerable<ObjectValue>(enumerableValuesProvider.ItemsSource);
                         * gridValuesProvider = enumerableValuesProvider;*/
                        DebugType debugListType;
                        var       debugListExpression = DebuggerHelpers.CreateDebugListExpression(shownExpr, itemType, out debugListType);
                        gridValuesProvider = CreateListValuesProvider(debugListExpression, debugListType, itemType);
                    }
                    else
                    {
                        // Value cannot be displayed in GridVisualizer
                        return;
                    }
                }

                IList <MemberInfo> itemTypeMembers = gridValuesProvider.GetItemTypeMembers();
                InitializeColumns((GridView)this.listView.View, itemTypeMembers);
                this.columnHider       = new GridViewColumnHider((GridView)this.listView.View);
                cmbColumns.ItemsSource = this.columnHider.HideableColumns;
            }
        }
コード例 #3
0
        public void Refresh()
        {
            try {
                // clear ListView
                listView.ItemsSource = null;
                ScrollViewer listViewScroller = listView.GetScrollViewer();
                if (listViewScroller != null)
                {
                    listViewScroller.ScrollToVerticalOffset(0);
                }
                Value shownValue = null;
                ICSharpCode.NRefactory.Ast.Expression shownExpr = null;
                try     {
                    shownExpr  = debuggerService.GetExpression(txtExpression.Text);
                    shownValue = shownExpr.Evaluate(debuggerService.DebuggedProcess);
                } catch (GetValueException e) {
                    MessageService.ShowMessage(e.Message);
                }
                if (shownValue != null && !shownValue.IsNull)
                {
                    GridValuesProvider gridValuesProvider;
                    // Value is IList
                    DebugType iListType, listItemType;
                    if (shownValue.Type.ResolveIListImplementation(out iListType, out listItemType))
                    {
                        gridValuesProvider = CreateListValuesProvider(shownExpr.CastToIList(), listItemType);
                    }
                    else
                    {
                        // Value is IEnumerable
                        DebugType iEnumerableType, itemType;
                        if (shownValue.Type.ResolveIEnumerableImplementation(out iEnumerableType, out itemType))
                        {
                            DebugType debugListType;
                            var       debugListExpression = DebuggerHelpers.CreateDebugListExpression(shownExpr, itemType, out debugListType);
                            gridValuesProvider = CreateListValuesProvider(debugListExpression, itemType);
                        }
                        else
                        {
                            // Not IList or IEnumerable<T> - can't be displayed in GridVisualizer
                            return;
                        }
                    }

                    IList <MemberInfo> itemTypeMembers = gridValuesProvider.GetItemTypeMembers();
                    InitializeColumns((GridView)this.listView.View, itemTypeMembers);
                    this.columnHider       = new GridViewColumnHider((GridView)this.listView.View);
                    cmbColumns.ItemsSource = this.columnHider.HideableColumns;
                }
            } catch (GetValueException e) {
                MessageService.ShowMessage(e.Message);
            } catch (DebuggerVisualizerException e) {
                MessageService.ShowMessage(e.Message);
            }
        }
コード例 #4
0
        public IEnumerableNode(Expression targetObject, DebugType itemType)
        {
            this.targetObject = targetObject;

            this.Name = "IEnumerable";
            this.Text = "Expanding will enumerate the IEnumerable";
            DebugType debugListType;

            this.debugListExpression = DebuggerHelpers.CreateDebugListExpression(targetObject, itemType, out debugListType);
            this.ChildNodes          = Utils.LazyGetItemsOfIList(this.debugListExpression);
        }
コード例 #5
0
        Activity IInstanceTable.GetActivity(string instanceId, string activityQualifiedName)
        {
            Activity activity2;

            try
            {
                base.Lock();
                activity2 = DebuggerHelpers.ParseActivity(base.GetReaderData()[new Guid(instanceId)].RootActivity, activityQualifiedName);
            }
            finally
            {
                base.Unlock();
            }
            return(activity2);
        }
コード例 #6
0
ファイル: IInstanceTable.cs プロジェクト: dox0/DotNet471RS3
        // DE invoked for watches through expression evaluation.
        Activity IInstanceTable.GetActivity(string instanceId, string activityQualifiedName)
        {
            try
            {
                Lock();


                Activity rootActivity = GetReaderData()[new Guid(instanceId)].RootActivity;
                return(DebuggerHelpers.ParseActivity(rootActivity, activityQualifiedName));
            }
            finally
            {
                Unlock();
            }
        }
コード例 #7
0
        public void Refresh()
        {
            try     {
                // clear ListView
                listView.ItemsSource = null;

                Value shownValue = getValue();

                ParameterizedType iListType, iEnumerableType;
                IType             itemType;
                // Value is IList
                if (shownValue.Type.ResolveIListImplementation(out iListType, out itemType))
                {
                    // Ok
                }
                else
                {
                    // Value is IEnumerable
                    if (shownValue.Type.ResolveIEnumerableImplementation(out iEnumerableType, out itemType))
                    {
                        shownValue = DebuggerHelpers.CreateListFromIEnumerable(shownValue);
                        shownValue.Type.ResolveIListImplementation(out iListType, out itemType);
                        //var ilistDef = iEnumerableType.Compilation.FindType(typeof(List<>)).GetDefinition();
                        //var ilistType = new ParameterizedType(ilistDef, ienumerableType.TypeArguments);
                    }
                    else
                    {
                        // Not IList or IEnumerable<T> - can't be displayed in GridVisualizer
                        return;
                    }
                }
                shownValue = shownValue.GetPermanentReference(WindowsDebugger.EvalThread);

                var       members         = itemType.GetFieldsAndNonIndexedProperties().Where(m => m.IsPublic && !m.IsStatic).ToList();
                IProperty indexerProperty = iListType.GetProperties(p => p.Name == "Item").Single();
                int       rowCount        = (int)shownValue.GetPropertyValue(WindowsDebugger.EvalThread, iListType.GetProperties(p => p.Name == "Count").Single()).PrimitiveValue;
                int       columnCount     = members.Count + 1;

                var rowCollection = new VirtualizingCollection <VirtualizingCollection <string> >(
                    rowCount,
                    (rowIndex) => new VirtualizingCollection <string>(
                        columnCount,
                        (columnIndex) => {
                    if (columnIndex == columnCount - 1)
                    {
                        return("[" + rowIndex + "]");
                    }
                    try {
                        var rowValue = shownValue.GetPropertyValue(WindowsDebugger.EvalThread, indexerProperty, Eval.CreateValue(WindowsDebugger.EvalThread, rowIndex));
                        return(rowValue.GetMemberValue(WindowsDebugger.EvalThread, members[columnIndex]).InvokeToString(WindowsDebugger.EvalThread));
                    } catch (GetValueException e) {
                        return("Exception: " + e.Message);
                    }
                }
                        )
                    );
                this.listView.ItemsSource = rowCollection;

                InitializeColumns((GridView)this.listView.View, members);

                GridViewColumnHider columnHider = new GridViewColumnHider((GridView)this.listView.View);
                cmbColumns.ItemsSource = columnHider.HideableColumns;
            } catch (GetValueException e) {
                MessageService.ShowMessage(e.Message);
            }
        }