Пример #1
0
        bool TryFormatKeyValuePair(DbgDotNetValue value)
        {
            var info = KeyValuePairTypeUtils.TryGetFields(value.Type);

            if ((object)info.keyField == null)
            {
                return(false);
            }
            var runtime = evalInfo.Runtime.GetDotNetRuntime();
            DbgDotNetValueResult keyResult = default, valueResult = default;
Пример #2
0
        public void Format(DbgDotNetValue value)
        {
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            evalInfo.CancellationToken.ThrowIfCancellationRequested();
            try {
                if (recursionCounter++ >= MAX_RECURSION)
                {
                    OutputWrite("???", DbgTextColor.Error);
                    return;
                }

                if (TrySimpleFormat(value))
                {
                    return;
                }
                var type       = value.Type;
                int tupleArity = TypeFormatterUtils.GetTupleArity(type);
                if (tupleArity > 0 && TryFormatTuple(value, tupleArity))
                {
                    return;
                }
                if (KeyValuePairTypeUtils.IsKeyValuePair(type) && TryFormatKeyValuePair(value, KeyValuePairTypeUtils.TryGetFields(value.Type)))
                {
                    return;
                }
                if (DictionaryEntryTypeUtils.IsDictionaryEntry(type) && TryFormatKeyValuePair(value, DictionaryEntryTypeUtils.TryGetFields(value.Type)))
                {
                    return;
                }
                if (TryFormatWithDebuggerAttributes(value))
                {
                    return;
                }
                if (TryFormatToString(value))
                {
                    return;
                }
                FormatTypeName(value);
            }
            finally {
                recursionCounter--;
            }
        }