Ejemplo n.º 1
0
        private void TypeValueReportFilterMenuitem_OnClick(object sender, RoutedEventArgs e)
        {
            if (_currentTreeViewItem == null)
            {
                return;
            }
            var curDispItem = _currentTreeViewItem.Tag as ClrtDisplayableType;

            Debug.Assert(curDispItem != null);
            if (curDispItem.HasAlternatives)
            {
                StatusText.Text = "This field '" + curDispItem.FieldName + "', has alternatives, itself cannot be queried.";
                return;
            }
            var dlg = new TypeValueFilterDlg(_currentTreeViewItem.Tag as ClrtDisplayableType)
            {
                Owner = this
            };
            bool?dlgResult = dlg.ShowDialog();

            if (dlgResult == true)
            {
                if (dlg.Remove)
                {
                    curDispItem.RemoveFilter();
                }
                else if (TypeExtractor.IsString(curDispItem.Kind))
                {
                    var   op    = dlg.Operator;
                    Regex regex = null;
                    if (FilterValue.IsOp(FilterValue.Op.REGEX, op))
                    {
                        regex = new Regex(dlg.ValueString);
                    }
                    curDispItem.SetFilter(new FilterValue(dlg.ValueString, curDispItem.Kind, dlg.Operator, regex));
                }
                else
                {
                    curDispItem.SetFilter(new FilterValue(dlg.ValueObject, curDispItem.Kind, dlg.Operator));
                }
                GuiUtils.UpdateTypeValueSetupTreeViewItem(_currentTreeViewItem, curDispItem);
                UpdateSelection(curDispItem);
            }
        }
Ejemplo n.º 2
0
        private void DialogOkClicked(object sender, RoutedEventArgs e)
        {
            string opStr = TypeValueOperator.SelectedItem as string;

            _operator = FilterValue.GetOpFromDescr(opStr);
            if (TypeExtractor.IsString(_kind))
            {
                _valStr = TbTypeValue.Text;
                _valObj = _valStr;
                if ((bool)TypeValueCase.IsChecked)
                {
                    _operator |= FilterValue.Op.IGNORECASE;
                }
                if ((bool)TypeValueRegex.IsChecked)
                {
                    _operator |= FilterValue.Op.REGEX;
                    try
                    {
                        Regex regex = new Regex(_valStr);
                    }
                    catch (ArgumentException ex)
                    {
                        GuiUtils.ShowError(ex, this);
                        return;
                    }
                }

                DialogResult = true;
                return;
            }
            _valStr = TbTypeValue.Text.Trim();
            if (TypeExtractor.GetTypeFromString(_valStr, _kind, out _valObj))
            {
                DialogResult = true;
                return;
            }
            MessageBox.Show("String format of the value is invalid.", "INVALID FORMAT", MessageBoxButton.OK, MessageBoxImage.Error);
        }
Ejemplo n.º 3
0
 private void Init()
 {
     foreach (FilterValue.Op op in Enum.GetValues(typeof(FilterValue.Op)))
     {
         if (TypeExtractor.IsString(_dispType.Kind) || TypeExtractor.IsGuid(_dispType.Kind))
         {
             if (op == FilterValue.Op.EQ ||
                 op == FilterValue.Op.NOTEQ ||
                 op == FilterValue.Op.CONTAINS ||
                 op == FilterValue.Op.NOTCONTAINS ||
                 op == FilterValue.Op.STARTSWITH ||
                 op == FilterValue.Op.ENDSWITH)
             {
                 TypeValueOperator.Items.Add(FilterValue.GetOpDescr(op));
             }
         }
         else
         {
             if (op == FilterValue.Op.EQ ||
                 op == FilterValue.Op.GT ||
                 op == FilterValue.Op.GTEQ ||
                 op == FilterValue.Op.LT ||
                 op == FilterValue.Op.NOTEQ ||
                 op == FilterValue.Op.LTEQ)
             {
                 TypeValueOperator.Items.Add(FilterValue.GetOpDescr(op));
             }
         }
     }
     TypeValueOperator.SelectedValue = FilterValue.GetOpDescr(FilterValue.Op.EQ);
     if (!TypeExtractor.IsString(_dispType.Kind))
     {
         TypeValueCase.IsEnabled  = false;
         TypeValueRegex.IsEnabled = false;
     }
 }
Ejemplo n.º 4
0
        private void InitFilterDescription()
        {
            _kind = _dispType.Kind;
            Debug.Assert(_kind != ClrElementKind.Unknown);
            var specKind = TypeExtractor.GetSpecialKind(_kind);

            if (TypeExtractor.IsString(_kind))
            {
                TypeValueDescr.Visibility = Visibility.Hidden;
                TypeValueCase.IsChecked   = _dispType.HasFilter && _dispType.Filter.IsIgnoreCase();
                TypeValueRegex.IsChecked  = _dispType.HasFilter && _dispType.Filter.IsRegex();
                return;
            }

            TypeValueCase.Visibility  = Visibility.Hidden;
            TypeValueRegex.Visibility = Visibility.Hidden;

            if (specKind != ClrElementKind.Unknown)
            {
                switch (specKind)
                {
                case ClrElementKind.Exception:
                    TypeValueDescr.Inlines.Add(new Run("Enter address in hex format: "));
                    TypeValueDescr.Inlines.Add(new Run("0x000083599c5498")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    TypeValueDescr.Inlines.Add(new Run(", leading zeros are not necessary."));
                    break;

                case ClrElementKind.Enum:
                    TypeValueDescr.Inlines.Add(new Run("Enum format is integral value of enumeration."));
                    break;

                case ClrElementKind.Free:
                    TypeValueDescr.Inlines.Add(new Run("Free type should not be filtered!")
                    {
                        FontWeight = FontWeights.Bold, Foreground = Brushes.Red
                    });
                    break;

                case ClrElementKind.Guid:
                    TypeValueDescr.Inlines.Add(new Run("Guid format ex.: "));
                    TypeValueDescr.Inlines.Add(new Run("00000000-0000-0000-0000-000000000000")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    break;

                case ClrElementKind.DateTime:
                    TypeValueDescr.Inlines.Add(new Run("DateTime format ex.: "));
                    TypeValueDescr.Inlines.Add(new Run("2009-06-15T13:45:30")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    TypeValueDescr.Inlines.Add(new Run(" -> 6/15/2009 1:45 PM"));
                    break;

                case ClrElementKind.TimeSpan:
                    TypeValueDescr.Inlines.Add(new Run("TimeSpan format ex.: "));
                    TypeValueDescr.Inlines.Add(new Run("1:3:16:50.5 ")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    break;

                case ClrElementKind.Decimal:
                    TypeValueDescr.Inlines.Add(new Run("Decimal format ex.: "));
                    TypeValueDescr.Inlines.Add(new Run("3.14159265")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    break;

                case ClrElementKind.SystemVoid:
                    TypeValueDescr.Inlines.Add(new Run("System.Void -- unexpected type!")
                    {
                        FontWeight = FontWeights.Bold, Foreground = Brushes.Red
                    });
                    break;

                case ClrElementKind.SystemObject:
                case ClrElementKind.Interface:
                case ClrElementKind.Abstract:
                case ClrElementKind.System__Canon:
                    TypeValueDescr.Inlines.Add(new Run("Enter address in hex format: "));
                    TypeValueDescr.Inlines.Add(new Run("0x000083599c5498")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    TypeValueDescr.Inlines.Add(new Run(", leading zeros are not necessary."));
                    break;

                default:
                    TypeValueDescr.Inlines.Add(new Run("Unexpected type!")
                    {
                        FontWeight = FontWeights.Bold, Foreground = Brushes.Red
                    });
                    break;
                }
            }
            else
            {
                var stdKind = TypeExtractor.GetStandardKind(_kind);
                switch (stdKind)
                {
                case ClrElementKind.Boolean:
                    TypeValueDescr.Inlines.Add(new Run("Valid values for this type, are: "));
                    TypeValueDescr.Inlines.Add(new Run("true")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    TypeValueDescr.Inlines.Add(new Run(" or "));
                    TypeValueDescr.Inlines.Add(new Run("false")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    break;

                case ClrElementKind.Class:
                case ClrElementKind.Struct:
                case ClrElementKind.SZArray:
                case ClrElementKind.Array:
                    break;

                case ClrElementKind.Object:
                    TypeValueDescr.Inlines.Add(new Run("Enter address in hex format: "));
                    TypeValueDescr.Inlines.Add(new Run("0x000083599c5498")
                    {
                        FontWeight = FontWeights.Bold
                    });
                    TypeValueDescr.Inlines.Add(new Run(", leading zeros are not necessary."));
                    break;

                case ClrElementKind.Char:
                case ClrElementKind.Int8:
                case ClrElementKind.UInt8:
                case ClrElementKind.Int16:
                case ClrElementKind.UInt16:
                case ClrElementKind.Int32:
                case ClrElementKind.UInt32:
                case ClrElementKind.Int64:
                case ClrElementKind.UInt64:
                case ClrElementKind.Float:
                case ClrElementKind.Double:
                case ClrElementKind.String:
                case ClrElementKind.Pointer:
                case ClrElementKind.NativeInt:
                case ClrElementKind.NativeUInt:
                case ClrElementKind.FunctionPointer:
                    TypeValueDescr.Inlines.Add(new Run("Primitive type: " + stdKind.ToString() + ", enter in standard format."));
                    break;

                default:
                    TypeValueDescr.Inlines.Add(new Run("Unexpected type!")
                    {
                        FontWeight = FontWeights.Bold, Foreground = Brushes.Red
                    });
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        public static object GetValue(ClrType type, ClrElementKind typeKind, ClrInstanceField field, ClrElementKind fldKind, ClrHeap heap, ulong addr, bool intr)
        {
            Debug.Assert(!TypeExtractor.IsUnknownStruct(typeKind) && !TypeExtractor.IsUnknownStruct(fldKind));
            if (TypeExtractor.IsAmbiguousKind(fldKind))
            {
                if (TypeExtractor.IsString(typeKind))
                {
                    var faddr = ValueExtractor.ReadUlongAtAddress(addr, heap);
                    return(ValueExtractor.GetStringAtAddress(faddr, heap));
                }

                if (TypeExtractor.IsKnownStruct(fldKind))
                {
                    switch (TypeExtractor.GetSpecialKind(fldKind))
                    {
                    case ClrElementKind.Decimal:
                        return(ValueExtractor.GetDecimalValue(addr, type));

                    case ClrElementKind.DateTime:
                        return(ValueExtractor.DateTimeValue(addr, type));

                    case ClrElementKind.TimeSpan:
                        return(ValueExtractor.TimeSpanValue(addr, type));

                    case ClrElementKind.Guid:
                        return(ValueExtractor.GuidValue(addr, type));

                    default:
                        return(Constants.DontKnowHowToGetValue);
                    }
                }

                if (TypeExtractor.IsPrimitive(typeKind))
                {
                    return(ValueExtractor.PrimitiveValueAsString(addr, type, typeKind));
                }
                if (TypeExtractor.IsObjectReference(typeKind))
                {
                    return(field.GetValue(addr, intr, false));
                }
                return(Constants.DontKnowHowToGetValue);
            }

            if (TypeExtractor.IsString(fldKind))
            {
                return(ValueExtractor.GetStringAtAddress(addr, intr, field));
            }

            if (TypeExtractor.IsKnownStruct(fldKind))
            {
                switch (TypeExtractor.GetSpecialKind(fldKind))
                {
                case ClrElementKind.Decimal:
                    return(ValueExtractor.GetDecimalPAF(addr, field, intr));

                case ClrElementKind.DateTime:
                    return(ValueExtractor.GetDateTimePAF(addr, field, intr));

                case ClrElementKind.TimeSpan:
                    return(ValueExtractor.GetTimeSpan(addr, field, intr));

                case ClrElementKind.Guid:
                    return(ValueExtractor.GetGuid(addr, field, intr));

                default:
                    return(Constants.DontKnowHowToGetValue);
                }
            }
            if (TypeExtractor.IsPrimitive(fldKind))
            {
                return(ValueExtractor.GetPrimitiveValueObject(addr, field, intr));
            }
            if (TypeExtractor.IsObjectReference(fldKind))
            {
                return(field.GetValue(addr, intr, false));
            }

            return(Constants.DontKnowHowToGetValue);
        }
Ejemplo n.º 6
0
        GetClassValueStrings(ClrHeap heap, ulong addr)
        {
            try
            {
                addr = Utils.RealAddress(addr);

                (ClrType type, ClrElementKind kind, ClrType rtype, ClrElementKind rkind) = TypeExtractor.GetRealType(heap, addr);
                if (type == null)
                {
                    return("Object Value Error" + Constants.HeavyGreekCrossPadded + "Cannot find an instance." + Constants.HeavyGreekCrossPadded + "Heap cannot get object type at address: " + Utils.RealAddressString(addr), null, ClrElementKind.Unknown, (null, null, null, null));
                }

                var fldCnt   = type.Fields.Count;
                var fldTypes = fldCnt == 0 ? Utils.EmptyArray <ClrType> .Value : new ClrType[fldCnt];
                var fldKinds = fldCnt == 0 ? Utils.EmptyArray <ClrElementKind> .Value : new ClrElementKind[fldCnt];
                var strings  = fldCnt == 0 ? Utils.EmptyArray <string> .Value : new string[fldCnt];
                StructValueStrings[] structVals = null;
                for (int i = 0; i < fldCnt; ++i)
                {
                    var fld     = type.Fields[i];
                    var fldType = fld.Type; // returns ClrElementKind.Unknown if fld.Type is null
                    fldTypes[i] = fldType;
                    var fldKind = TypeExtractor.GetElementKind(fldType);
                    fldKinds[i] = fldKind;
                    if (fldKind == ClrElementKind.Unknown)
                    {
                        strings[i] = Constants.UnknownValue;
                        continue; // nothing to do here, from MDR lib: There is
                                  // a bug in several versions of our debugging layer which causes this.
                    }
                    if (TypeExtractor.IsAmbiguousKind(fldKind))
                    {
                        (ClrType aType, ClrElementKind aKind) = TypeExtractor.GetReferenceFieldRealTypeAndKind(heap, addr, fld);
                        if (aType != null)
                        {
                            fldType     = aType;
                            fldTypes[i] = fldType;
                            fldKind     = aKind;
                            fldKinds[i] = fldKind;
                        }
                    }
                    if (TypeExtractor.IsString(fldKind))
                    {
                        var o = fld.GetValue(addr, false, true);
                        strings[i] = o == null ? Constants.NullValue : o.ToString();
                    }
                    else if (TypeExtractor.IsObjectReference(fldKind))
                    {
                        var obj = fld.GetValue(addr, false, false);
                        strings[i] = obj == null ? Constants.InvalidAddressStr : Utils.RealAddressString((ulong)obj);
                    }
                    else if (TypeExtractor.IsEnum(fldKind))
                    {
                        strings[i] = ValueExtractor.GetEnumString(addr, fld, false);
                    }
                    else if (fldType.IsPrimitive)
                    {
                        strings[i] = ValueExtractor.PrimitiveValue(addr, fld, false);
                    }
                    else if (TypeExtractor.IsKnownStruct(fldKind))
                    {
                        switch (TypeExtractor.GetSpecialKind(fldKind))
                        {
                        case ClrElementKind.DateTime:
                            strings[i] = ValueExtractor.GetDateTimeString(addr, fld, false);
                            break;

                        case ClrElementKind.Guid:
                            strings[i] = ValueExtractor.GuidValueAsString(addr, fldType, false);
                            break;

                        case ClrElementKind.Decimal:
                            strings[i] = ValueExtractor.DecimalStringPAF(addr, fld, false);
                            break;

                        case ClrElementKind.TimeSpan:
                            strings[i] = ValueExtractor.TimeSpanValueAsString(addr, fldType);
                            break;
                        }
                    }
                    else if (TypeExtractor.IsUnknownStruct(fldKind))
                    {
                        StructFields   sf  = StructFields.GetStructFields(fldType);
                        StructFieldsEx sfx = StructFieldsEx.GetStructFields(sf, fldType);
                        sfx.ResetTypes();
                        if (structVals == null)
                        {
                            structVals = new StructValueStrings[fldCnt];
                        }
                        ulong structAddr = fld.GetAddress(addr, false);
                        structVals[i] = StructFieldsEx.GetStructValueStrings(sfx, heap, structAddr);
                    }
                }
                //if (!Utils.SameStrings(fld.Type.Name,fldType.Name))
                //    {
                //        ulong fldAddr = fld.GetAddress(addr, type.IsValueClass);
                //        if (TypeExtractor.IsString(fldKind))
                //        {
                //            var obj = ValueExtractor.GetStringValue(fldType, fldAddr);
                //            strings[i] = obj == null ? Constants.NullValue : (string)obj;
                //        }
                //        else if (TypeExtractor.IsObjectReference(fldKind))
                //        {
                //            var obj = fld.GetValue(addr, false, false);
                //            strings[i] = obj == null ? Constants.InvalidAddressStr : Utils.RealAddressString((ulong)obj);
                //        }
                //        else if (TypeExtractor.IsEnum(fldKind))
                //        {
                //            long intVal;
                //            strings[i] = ValueExtractor.GetEnumValueString(fldAddr, fldType, out intVal);
                //        }
                //        else if (fldType.IsPrimitive)
                //        {
                //            var obj = fld.Type.GetValue(fldAddr);
                //            strings[i] = ValueExtractor.PrimitiveValue(obj, fldKind);
                //        }
                //        else if (TypeExtractor.IsKnownStruct(fldKind))
                //        {
                //            switch (TypeExtractor.GetSpecialKind(fldKind))
                //            {
                //                case ClrElementKind.DateTime:
                //                    strings[i] = ValueExtractor.DateTimeValueString(fldAddr, fldType, null);
                //                    break;
                //                case ClrElementKind.Guid:
                //                    strings[i] = ValueExtractor.GuidValueAsString(fldAddr, fldType);
                //                    break;
                //                case ClrElementKind.Decimal:
                //                    strings[i] = ValueExtractor.DecimalValueAsString(fldAddr, fldType,null);
                //                    break;
                //                case ClrElementKind.TimeSpan:
                //                    strings[i] = ValueExtractor.TimeSpanValueAsString(fldAddr, fldType);
                //                    break;
                //            }
                //        }
                //        else if (TypeExtractor.IsUnknownStruct(fldKind))
                //        {
                //            StructFields sf = StructFields.GetStructFields(fldType);
                //            StructFieldsEx sfx = StructFieldsEx.GetStructFields(sf, fldType);
                //            sfx.ResetTypes();
                //            if (structVals == null) structVals = new StructValueStrings[fldCnt];
                //            ulong structAddr = fld.GetAddress(addr, false);
                //            structVals[i] = StructFieldsEx.GetStructValueStrings(sfx, heap, structAddr);
                //        }

                //        continue;


                return(null, type, kind, (fldTypes, fldKinds, strings, structVals));
            }
            catch (Exception ex)
            {
                return(Utils.GetExceptionErrorString(ex), null, ClrElementKind.Unknown, (null, null, null, null));
            }
        }
Ejemplo n.º 7
0
        GetClassValues(ClrHeap heap, ulong addr)
        {
            try
            {
                addr = Utils.RealAddress(addr);
                (ClrType type, ClrElementKind kind, ClrType rtType, ClrElementKind rtKind) = TypeExtractor.GetRealType(heap, addr);

                if (type == null)
                {
                    return("Object Value Error" + Constants.HeavyGreekCrossPadded + "Cannot find an instance." + Constants.HeavyGreekCrossPadded + "Heap cannot get object type at address: " + Utils.RealAddressString(addr), null, ClrElementKind.Unknown, (null, null, null, null, null));
                }
                var fldCnt = type.Fields.Count;

                var                fldTypes       = fldCnt == 0 ? Utils.EmptyArray <ClrType> .Value : new ClrType[fldCnt];
                var                fldKinds       = fldCnt == 0 ? Utils.EmptyArray <ClrElementKind> .Value : new ClrElementKind[fldCnt];
                var                objects        = fldCnt == 0 ? Utils.EmptyArray <object> .Value : new object[fldCnt];
                StructValues[]     structVals     = null;
                StructFieldsInfo[] structFldInfos = null;
                for (int i = 0; i < fldCnt; ++i)
                {
                    var fld     = type.Fields[i];
                    var fldType = fld.Type; // returns ClrElementKind.Unknown if fld.Type is null
                    var fldKind = TypeExtractor.GetElementKind(fldType);
                    if (fldKind == ClrElementKind.Unknown)
                    {
                        objects[i] = null;
                        continue; // nothing to do here, from MDR lib: There is
                                  // a bug in several versions of our debugging layer which causes this.
                    }
                    if (fldType == null || TypeExtractor.IsAmbiguousKind(fldKind))
                    {
                        var fldValObj = fld.GetValue(addr, type.IsValueClass, false);
                        if (fldValObj != null && fldValObj is ulong)
                        {
                            var t = heap.GetObjectType((ulong)fldValObj);
                            if (t != null)
                            {
                                fldType = t;
                                fldKind = TypeExtractor.GetElementKind(t);
                            }
                        }
                    }
                    fldTypes[i] = fldType;
                    fldKinds[i] = fldKind;
                    if (fldKind == ClrElementKind.Unknown)
                    {
                        continue;                                    // nothing to do here, from MDR lib: There is
                    }
                    // a bug in several versions of our debugging layer which causes this.
                    if (TypeExtractor.IsString(fldKind))
                    {
                        objects[i] = fld.GetValue(addr, false, true);
                    }
                    else if (TypeExtractor.IsObjectReference(fldKind))
                    {
                        object obj = fld.GetValue(addr, false, false);
                        if (obj != null && (ulong)obj != Constants.InvalidAddress)
                        {
                            var t = heap.GetObjectType((ulong)obj);
                            if (t != null)
                            {
                                var k = TypeExtractor.GetElementKind(t);
                                fldTypes[i] = t;
                                fldKinds[i] = k;
                            }
                        }

                        objects[i] = obj;
                    }
                    else if (TypeExtractor.IsEnum(fldKind))
                    {
                        objects[i] = ValueExtractor.GetEnumValueObject(addr, fld, false);
                    }
                    else if (fldType.IsPrimitive)
                    {
                        objects[i] = ValueExtractor.GetPrimitiveValueObject(addr, fld, false);
                    }
                    else if (TypeExtractor.IsKnownStruct(fldKind))
                    {
                        switch (TypeExtractor.GetSpecialKind(fldKind))
                        {
                        case ClrElementKind.DateTime:
                            objects[i] = ValueExtractor.GetDateTimePAF(addr, fld, false);
                            break;

                        case ClrElementKind.Guid:
                            objects[i] = ValueExtractor.GetGuid(addr, fld, false);
                            break;

                        case ClrElementKind.Decimal:
                            objects[i] = ValueExtractor.GetDecimalPAF(addr, fld, false);
                            break;

                        case ClrElementKind.TimeSpan:
                            objects[i] = ValueExtractor.TimeSpanValue(addr, fldType);
                            break;
                        }
                    }
                    else if (TypeExtractor.IsUnknownStruct(fldKind))
                    {
                        //StructFields sf = StructFields.GetStructFields(fldType);
                        //StructFieldsEx sfx = StructFieldsEx.GetStructFields(sf, fldType);
                        if (structFldInfos == null)
                        {
                            structFldInfos = new StructFieldsInfo[fldCnt];
                        }
                        ulong            saddr = fld.GetAddress(addr, true);
                        StructFieldsInfo sfi   = StructFieldsInfo.GetStructFields(fldType, heap, saddr);
                        structFldInfos[i] = sfi;
                        if (sfi != null)
                        {
                            if (structVals == null)
                            {
                                structVals = new StructValues[fldCnt];
                            }
                            structVals[i] = StructFieldsInfo.GetStructValues(sfi, heap, saddr);
                        }
                    }
                }

                return(null, type, kind, (fldTypes, fldKinds, objects, structFldInfos, structVals));
            }
            catch (Exception ex)
            {
                return(Utils.GetExceptionErrorString(ex), null, ClrElementKind.Unknown, (null, null, null, null, null));
            }
        }
Ejemplo n.º 8
0
        private async void GetInstanceValue(TreeViewItem selTreeItem, InstanceValue selInstValue, bool rawValue = false)
        {
            if (TypeExtractor.IsString(selInstValue.Kind))
            {
                if (selInstValue.Value.IsLong())
                {
                    ValueWindows.ShowContentWindow(selInstValue.GetDescription(), selInstValue, ValueWindows.WndType.Content);
                }
                return;
            }

            if (selInstValue.HaveFields())
            {
                return;                            // already has values
            }
            ulong addr = _mainWindow.GetAddressFromEntry(selInstValue.Value.FullContent);

            if (selInstValue.Address != Constants.InvalidAddress && addr != Constants.InvalidAddress && addr == selInstValue.Address)
            {
                if (!rawValue) // if known collection show it in a collection window
                {
                    if (TypeExtractor.IsKnownType(selInstValue.TypeName))
                    {
                        var msg = "Getting object value at: " + Utils.RealAddressString(selInstValue.Address);
                        _mainWindow.ExecuteInstanceValueQuery(msg, selInstValue.Address);
                        return;
                    }
                }
                var index = MainWindow.CurrentIndex;

                StatusText.Text      = "Getting value at address: " + selInstValue.Address + ", please wait...";
                Mouse.OverrideCursor = Cursors.Wait;

                (string error, InstanceValue[] fields) = await Task.Factory.StartNew(() =>
                {
                    return(index.GetInstanceValueFields(selInstValue.Address, selInstValue.Parent));
                }, _mainWindow.DumpSTAScheduler);

                if (Utils.IsInformation(error))
                {
                    StatusText.Text = error;
                }
                else
                {
                    StatusText.Text = "Getting fields at address: " + selInstValue.Address + (fields != null ? ", done." : ", failed.");
                }
                Mouse.OverrideCursor = null;

                if (error != null && !Utils.IsInformation(error))
                {
                    GuiUtils.ShowError(error, this);
                    return;
                }

                if (fields.Length < 1)
                {
                    return;
                }

                if (fields.Length == 1 && fields[0].IsArray())
                {
                    ValueWindows.ShowContentWindow(fields[0].GetDescription(), fields[0], ValueWindows.WndType.List);
                    return;
                }

                if (fields.Length > 0)
                {
                    selInstValue.SetFields(fields);
                    for (int i = 0, icount = fields.Length; i < icount; ++i)
                    {
                        var fld    = fields[i];
                        var tvNode = new TreeViewItem
                        {
                            Header = GuiUtils.GetInstanceValueStackPanel(fld),
                            Tag    = fld
                        };
                        selTreeItem.Items.Add(tvNode);
                    }
                }
                selTreeItem.ExpandSubtree();
            }
            else
            {
                StatusText.Text = "Value for " + selInstValue.TypeName + " cannot be expanded.";
                return;
            }
        }