Пример #1
0
        public async Task Build_ArrayCapsAtArraySizeAsync()
        {
            IVariableInformation varInfo = CreateVarInfo(_remoteValue, "10");
            string result = await ValueStringBuilder.BuildAsync(varInfo);

            Assert.That(result, Is.EqualTo("{20, 21, 22, 23, 24}"));
        }
Пример #2
0
        public async Task Build_ArraySpecifiedNumberOfChildrenAsync()
        {
            IVariableInformation varInfo = CreateVarInfo(_remoteValue, "3");
            string result = await ValueStringBuilder.BuildAsync(varInfo);

            Assert.That(result, Is.EqualTo("{20, 21, 22}"));
        }
Пример #3
0
        public async Task Build_PointerArraySpecifiedNumberOfChildrenAsync()
        {
            IVariableInformation varInfo = CreateVarInfo(_pointerValue, "7");
            string result = await ValueStringBuilder.BuildAsync(varInfo);

            Assert.That(
                result,
                Is.EqualTo(
                    $"0x{_pointerAddress:x16} {{20, 21, 22, 23, 24, <invalid>, <invalid>}}"));
        }
Пример #4
0
        public async Task Build_ClassValueAsync()
        {
            RemoteValueFake classValue = RemoteValueFakeUtil.CreateClass("C", "c", "");

            classValue.AddChild(RemoteValueFakeUtil.CreateSimpleInt("f", 42));
            classValue.AddChild(RemoteValueFakeUtil.CreateSimpleString("g", "\"s\""));

            IVariableInformation varInfo = CreateVarInfo(classValue, "3");
            string result = await ValueStringBuilder.BuildAsync(varInfo);

            Assert.That(result, Is.EqualTo("{f=42 g=\"s\"}"));
        }
Пример #5
0
        public async Task Build_PointerClassValueAsync()
        {
            string          address = $"0x{_pointerAddress:x16}";
            RemoteValueFake pointer =
                RemoteValueFakeUtil.CreatePointer("C*", "pc", _pointerAddress.ToString());

            pointer.AddChild(RemoteValueFakeUtil.CreateSimpleInt("f", 42));
            pointer.AddChild(RemoteValueFakeUtil.CreateSimpleString("g", "\"s\""));

            IVariableInformation varInfo = CreateVarInfo(pointer, "");
            string result = await ValueStringBuilder.BuildAsync(varInfo);

            Assert.That(result, Is.EqualTo($"0x{_pointerAddress:x16} {{f=42 g=\"s\"}}"));
        }
Пример #6
0
        public async Task Build_ArrayLimitsOutputSizeAsync()
        {
            const int size = 100;

            _childValues = Enumerable.Range(0, size - 1).ToArray();
            _remoteValue = RemoteValueFakeUtil.CreateSimpleIntArray("myArray", _childValues);

            IVariableInformation varInfo = CreateVarInfo(_remoteValue, size.ToString());
            string result = await ValueStringBuilder.BuildAsync(varInfo);

            Assert.That(
                result,
                Is.EqualTo(
                    "{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20," +
                    " 21, ...}"));
        }
 internal async Task <string> FormatDisplayStringAsync(
     FormatStringContext formatStringContext, IVariableInformation variable) =>
 await FormatStringAsync(formatStringContext, variable, FormatDisplayStringAsync,
                         "display string",
                         async() => await ValueStringBuilder.BuildAsync(variable));
Пример #8
0
        public async Task <int> GetPropertyInfoAsync(enum_DEBUGPROP_INFO_FLAGS fields, uint radix,
                                                     uint timeout, IDebugReference2[] args,
                                                     uint argCount,
                                                     DEBUG_PROPERTY_INFO[] propertyInfo)
        {
            var info = new DEBUG_PROPERTY_INFO();

            _varInfo.FallbackValueFormat = GetFallbackValueFormat(radix);
            IVariableInformation cachedVarInfo = _varInfo.GetCachedView();

            if ((enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME & fields) != 0)
            {
                string fullname = cachedVarInfo.Fullname();
                if (!string.IsNullOrWhiteSpace(fullname))
                {
                    info.bstrFullName = _vsExpressionCreator
                                        .Create(fullname, cachedVarInfo.FormatSpecifier)
                                        .ToString();

                    info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME;
                }
            }

            if ((enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME & fields) != 0)
            {
                info.bstrName  = cachedVarInfo.DisplayName;
                info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME;
            }

            if ((enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE & fields) != 0)
            {
                info.bstrType  = cachedVarInfo.TypeName;
                info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE;
            }

            if ((enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE & fields) != 0)
            {
                if ((enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_AUTOEXPAND & fields) != 0)
                {
                    // The value field is in read-only mode, so we can display additional
                    // information that would normally fail to parse as a proper expression.
                    info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_AUTOEXPAND;

                    info.bstrValue = await ValueStringBuilder.BuildAsync(cachedVarInfo);
                }
                else
                {
                    // The value field is in editing mode, so only display the assignment value.
                    info.bstrValue = cachedVarInfo.AssignmentValue;
                }

                info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE;
            }

            if ((enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP & fields) != 0)
            {
                info.pProperty = Self;
                info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP;
            }

            if ((enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB & fields) != 0)
            {
                if (cachedVarInfo.Error)
                {
                    info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_ERROR;
                }

                if (cachedVarInfo.MightHaveChildren())
                {
                    info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE;
                }

                if (cachedVarInfo.IsReadOnly)
                {
                    info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
                }

                if (!string.IsNullOrEmpty(cachedVarInfo.StringView))
                {
                    // Causes Visual Studio to show the text visualizer selector. i.e. the
                    // magnifying glass with Text Visualizer, XML Visualizer, etc.
                    info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_RAW_STRING;
                }

                info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB;
            }

            propertyInfo[0] = info;
            return(VSConstants.S_OK);
        }