• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ExpressionEvaluator.EvalResultDataItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.CodeAnalysis.ExpressionEvaluator.EvalResultDataItem的典型用法代码示例。如果您正苦于以下问题:C# EvalResultDataItem类的具体用法?C# EvalResultDataItem怎么用?C# EvalResultDataItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EvalResultDataItem类属于Microsoft.CodeAnalysis.ExpressionEvaluator命名空间,在下文中一共展示了EvalResultDataItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetRow

 private EvalResult GetRow(
     ResultProvider resultProvider,
     DkmInspectionContext inspectionContext,
     DkmClrValue value,
     int index,
     EvalResultDataItem parent)
 {
     var indices = GetIndices(index);
     var fullNameProvider = resultProvider.FullNameProvider;
     var name = fullNameProvider.GetClrArrayIndexExpression(inspectionContext, indices);
     var element = value.GetArrayElement(indices, inspectionContext);
     var fullName = GetFullName(inspectionContext, parent, name, fullNameProvider);
     return resultProvider.CreateDataItem(
         inspectionContext,
         name,
         typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
         declaredTypeAndInfo: _elementTypeAndInfo,
         value: element,
         useDebuggerDisplay: parent != null,
         expansionFlags: ExpansionFlags.IncludeBaseMembers,
         childShouldParenthesize: false,
         fullName: fullName,
         formatSpecifiers: Formatter.NoFormatSpecifiers,
         category: DkmEvaluationResultCategory.Other,
         flags: element.EvalFlags,
         evalFlags: inspectionContext.EvaluationFlags);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:27,代码来源:ArrayExpansion.cs


示例2: GetRow

 private EvalResult GetRow(
     DkmInspectionContext inspectionContext,
     DkmClrValue value,
     int index,
     EvalResultDataItem parent)
 {
     var typeParameter = _typeParameters[index];
     var typeArgument = _typeArguments[index];
     var typeArgumentInfo = _customTypeInfoMap.SubstituteCustomTypeInfo(typeParameter, customInfo: null);
     var formatSpecifiers = Formatter.NoFormatSpecifiers;
     return new EvalResult(
         ExpansionKind.TypeVariable,
         typeParameter.Name,
         typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
         declaredTypeAndInfo: new TypeAndCustomInfo(DkmClrType.Create(value.Type.AppDomain, typeArgument), typeArgumentInfo),
         useDebuggerDisplay: parent != null,
         value: value,
         displayValue: inspectionContext.GetTypeName(DkmClrType.Create(value.Type.AppDomain, typeArgument), typeArgumentInfo, formatSpecifiers),
         expansion: null,
         childShouldParenthesize: false,
         fullName: null,
         childFullNamePrefixOpt: null,
         formatSpecifiers: formatSpecifiers,
         category: DkmEvaluationResultCategory.Data,
         flags: DkmEvaluationResultFlags.ReadOnly,
         editableValue: null,
         inspectionContext: inspectionContext);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:28,代码来源:TypeVariablesExpansion.cs


示例3: GetRow

 private DkmEvaluationResult GetRow(
     ResultProvider resultProvider,
     DkmInspectionContext inspectionContext,
     DkmClrValue value,
     int index,
     EvalResultDataItem parent)
 {
     var indices = GetIndices(index);
     var formatter = resultProvider.Formatter;
     var name = formatter.GetArrayIndexExpression(indices);
     var elementType = value.Type.ElementType;
     var element = value.GetArrayElement(indices);
     var fullName = GetFullName(parent, name, formatter);
     var dataItem = resultProvider.CreateDataItem(
         inspectionContext,
         name,
         typeDeclaringMember: null,
         declaredType: elementType.GetLmrType(),
         value: element,
         parent: parent,
         expansionFlags: ExpansionFlags.IncludeBaseMembers,
         childShouldParenthesize: false,
         fullName: fullName,
         formatSpecifiers: Formatter.NoFormatSpecifiers,
         category: DkmEvaluationResultCategory.Other,
         flags: element.EvalFlags,
         evalFlags: inspectionContext.EvaluationFlags);
     return resultProvider.GetResult(dataItem, element.Type, elementType, parent);
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:29,代码来源:ArrayExpansion.cs


示例4: GetRows

        internal override void GetRows(
            ResultProvider resultProvider,
            ArrayBuilder<EvalResult> rows,
            DkmInspectionContext inspectionContext,
            EvalResultDataItem parent,
            DkmClrValue value,
            int startIndex,
            int count,
            bool visitAll,
            ref int index)
        {
            var fields = GetFields();

            int startIndex2;
            int count2;
            GetIntersection(startIndex, count, index, fields.Count, out startIndex2, out count2);

            int offset = startIndex2 - index;
            for (int i = 0; i < count2; i++)
            {
                var row = GetMemberRow(resultProvider, inspectionContext, value, fields[i + offset], parent);
                rows.Add(row);
            }

            index += fields.Count;
        }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:26,代码来源:TupleExpansion.cs


示例5: GetRows

 /// <summary>
 /// Get the rows within the given range. 'index' is advanced
 /// to the end of the range, or if 'visitAll' is true, 'index' is
 /// advanced to the end of the expansion.
 /// </summary>
 internal abstract void GetRows(
     ResultProvider resultProvider,
     ArrayBuilder<DkmEvaluationResult> rows,
     DkmInspectionContext inspectionContext,
     EvalResultDataItem parent,
     DkmClrValue value,
     int startIndex,
     int count,
     bool visitAll,
     ref int index);
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:15,代码来源:Expansion.cs


示例6: GetRow

        private static DkmEvaluationResult GetRow(
            ResultProvider resultProvider,
            DkmInspectionContext inspectionContext,
            DkmClrValue pointer,
            Type elementType,
            EvalResultDataItem parent)
        {
            var value = pointer.Dereference();
            var valueType = value.Type.GetLmrType();
            var wasExceptionThrown = value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown);

            string debuggerDisplayName;
            string debuggerDisplayValue;
            string debuggerDisplayType;
            value.GetDebuggerDisplayStrings(out debuggerDisplayName, out debuggerDisplayValue, out debuggerDisplayType);

            var declaredType = elementType;
            var typeName = debuggerDisplayType ?? pointer.InspectionContext.GetTypeName(DkmClrType.Create(pointer.Type.AppDomain, declaredType));
            var expansion = wasExceptionThrown
                ? null
                : resultProvider.GetTypeExpansion(inspectionContext, declaredType, value, ExpansionFlags.None);
            var fullName = string.Format("*{0}", parent.ChildFullNamePrefix);
            var editableValue = resultProvider.Formatter.GetEditableValue(value);

            // NB: Full name is based on the real (i.e. not DebuggerDisplay) name.  This is a change from dev12, 
            // which used the DebuggerDisplay name, causing surprising results in "Add Watch" scenarios.
            var dataItem = new EvalResultDataItem(
                name: null, // Okay for pointer dereferences.
                typeDeclaringMember: null,
                declaredType: declaredType,
                value: value,
                expansion: expansion,
                childShouldParenthesize: true,
                fullName: fullName,
                childFullNamePrefixOpt: fullName,
                formatSpecifiers: Formatter.NoFormatSpecifiers,
                category: DkmEvaluationResultCategory.Other,
                flags: DkmEvaluationResultFlags.None,
                editableValue: editableValue);

            var name = debuggerDisplayName ?? fullName;
            var display = debuggerDisplayValue ?? 
                (wasExceptionThrown ? string.Format(Resources.InvalidPointerDereference, fullName) : value.GetValueString());

            return ResultProvider.CreateEvaluationResult(
                value,
                name,
                typeName,
                display,
                dataItem);
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:51,代码来源:PointerDereferenceExpansion.cs


示例7: GetMemberRow

        private static EvalResult GetMemberRow(
            ResultProvider resultProvider,
            DkmInspectionContext inspectionContext,
            DkmClrValue value,
            Field field,
            EvalResultDataItem parent)
        {
            var fullNameProvider = resultProvider.FullNameProvider;
            var parentFullName = parent.ChildFullNamePrefix;
            if (parentFullName != null)
            {
                if (parent.ChildShouldParenthesize)
                {
                    parentFullName = parentFullName.Parenthesize();
                }
                var parentRuntimeType = parent.Value.Type;
                if (!parent.DeclaredTypeAndInfo.Type.Equals(parentRuntimeType.GetLmrType()))
                {
                    parentFullName = fullNameProvider.GetClrCastExpression(inspectionContext, parentFullName, parentRuntimeType, customTypeInfo: null, parenthesizeArgument: false, parenthesizeEntireExpression: true);
                }
            }

            // Ideally if the caller requests multiple items in a nested tuple
            // we should only evaluate Rest once, and should only calculate
            // the full name for Rest once.
            string fullName;
            var fieldValue = GetValueAndFullName(
                fullNameProvider,
                inspectionContext,
                value,
                field,
                parentFullName,
                out fullName);
            return resultProvider.CreateDataItem(
                inspectionContext,
                field.Name,
                typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                declaredTypeAndInfo: field.FieldTypeAndInfo,
                value: fieldValue,
                useDebuggerDisplay: false,
                expansionFlags: ExpansionFlags.All,
                childShouldParenthesize: false,
                fullName: fullName,
                formatSpecifiers: Formatter.NoFormatSpecifiers,
                category: DkmEvaluationResultCategory.Other,
                flags: fieldValue.EvalFlags,
                evalFlags: DkmEvaluationFlags.None);
        }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:48,代码来源:TupleExpansion.cs


示例8: CreateResultsOnly

        internal static DkmEvaluationResult CreateResultsOnly(
            string name,
            DkmClrType declaredType,
            DkmClrValue value,
            EvalResultDataItem parent,
            Formatter formatter)
        {
            string errorMessage;
            if (value.IsError())
            {
                errorMessage = (string)value.HostObjectValue;
            }
            else if (value.HasExceptionThrown(parent))
            {
                errorMessage = value.GetExceptionMessage(name, formatter);
            }
            else
            {
                var enumerableType = GetEnumerableType(value);
                if (enumerableType != null)
                {
                    var expansion = CreateExpansion(value, enumerableType, formatter);
                    if (expansion != null)
                    {
                        return expansion.CreateEvaluationResult(name, parent, formatter);
                    }
                    errorMessage = Resources.ResultsViewNoSystemCore;
                }
                else
                {
                    errorMessage = Resources.ResultsViewNotEnumerable;
                }
            }

            Debug.Assert(errorMessage != null);
            return DkmFailedEvaluationResult.Create(
                InspectionContext: value.InspectionContext,
                StackFrame: value.StackFrame,
                Name: name,
                FullName: null,
                ErrorMessage: errorMessage,
                Flags: DkmEvaluationResultFlags.None,
                Type: null,
                DataItem: null);
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:45,代码来源:ResultsViewExpansion.cs


示例9: GetRows

        internal override void GetRows(
            ResultProvider resultProvider,
            ArrayBuilder<EvalResultDataItem> rows,
            DkmInspectionContext inspectionContext,
            EvalResultDataItem parent,
            DkmClrValue value,
            int startIndex,
            int count,
            bool visitAll,
            ref int index)
        {
            if (InRange(startIndex, count, index))
            {
                rows.Add(GetRow(resultProvider, inspectionContext, value, _elementTypeAndInfo, parent: parent));
            }

            index++;
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:18,代码来源:PointerDereferenceExpansion.cs


示例10: GetRows

        internal override void GetRows(
            ResultProvider resultProvider,
            ArrayBuilder<EvalResult> rows,
            DkmInspectionContext inspectionContext,
            EvalResultDataItem parent,
            DkmClrValue value,
            int startIndex,
            int count,
            bool visitAll,
            ref int index)
        {
            if (InRange(startIndex, count, index))
            {
                rows.Add(CreateDynamicViewRow(inspectionContext, Resources.DynamicView, parent, resultProvider.FullNameProvider));
            }

            index++;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:18,代码来源:DynamicViewExpansion.cs


示例11: GetRows

 internal override void GetRows(
     ResultProvider resultProvider,
     ArrayBuilder<EvalResult> rows,
     DkmInspectionContext inspectionContext,
     EvalResultDataItem parent,
     DkmClrValue value,
     int startIndex,
     int count,
     bool visitAll,
     ref int index)
 {
     var memberValue = value.GetMemberValue(_member, inspectionContext);
     var isDynamicDebugViewEmptyException = memberValue.Type.GetLmrType().IsDynamicDebugViewEmptyException();
     if (isDynamicDebugViewEmptyException || memberValue.IsError())
     {
         if (InRange(startIndex, count, index))
         {
             if (isDynamicDebugViewEmptyException)
             {
                 var emptyMember = memberValue.Type.GetMemberByName("Empty");
                 memberValue = memberValue.GetMemberValue(emptyMember, inspectionContext);
             }
             var row = new EvalResult(Resources.ErrorName, (string)memberValue.HostObjectValue, inspectionContext);
             rows.Add(row);
         }
         index++;
     }
     else
     {
         var other = MemberExpansion.CreateMemberDataItem(
             resultProvider,
             inspectionContext,
             _member,
             memberValue,
             parent,
             _dynamicFlagsMap,
             ExpansionFlags.IncludeBaseMembers | ExpansionFlags.IncludeResultsView);
         var expansion = other.Expansion;
         if (expansion != null)
         {
             expansion.GetRows(resultProvider, rows, inspectionContext, other.ToDataItem(), other.Value, startIndex, count, visitAll, ref index);
         }
     }
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:44,代码来源:RootHiddenExpansion.cs


示例12: GetRows

 internal override void GetRows(
     ResultProvider resultProvider,
     ArrayBuilder<EvalResultDataItem> rows,
     DkmInspectionContext inspectionContext,
     EvalResultDataItem parent,
     DkmClrValue value,
     int startIndex,
     int count,
     bool visitAll,
     ref int index)
 {
     foreach (var expansion in _expansions)
     {
         expansion.GetRows(resultProvider, rows, inspectionContext, parent, value, startIndex, count, visitAll, ref index);
         if (!visitAll && (index >= startIndex + count))
         {
             return;
         }
     }
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:20,代码来源:AggregateExpansion.cs


示例13: GetRow

 private DkmEvaluationResult GetRow(ResultProvider resultProvider, DkmClrValue value, int index, EvalResultDataItem parent)
 {
     var inspectionContext = value.InspectionContext;
     var appDomain = value.Type.AppDomain;
     var typeParameter = _typeParameters[index];
     var typeArgument = _typeArguments[index];
     var type = DkmClrType.Create(appDomain, typeArgument);
     var name = typeParameter.Name;
     var dataItem = new EvalResultDataItem(
         name,
         typeDeclaringMember: null,
         declaredType: typeArgument,
         value: null,
         expansion: null,
         childShouldParenthesize: false,
         fullName: null,
         childFullNamePrefixOpt: null,
         formatSpecifiers: Formatter.NoFormatSpecifiers,
         category: DkmEvaluationResultCategory.Data,
         flags: DkmEvaluationResultFlags.ReadOnly,
         editableValue: null);
     var typeName = inspectionContext.GetTypeName(DkmClrType.Create(appDomain, typeArgument));
     return DkmSuccessEvaluationResult.Create(
         inspectionContext,
         value.StackFrame,
         name,
         dataItem.FullName,
         dataItem.Flags,
         Value: typeName,
         EditableValue: null,
         Type: typeName,
         Category: dataItem.Category,
         Access: value.Access,
         StorageType: value.StorageType,
         TypeModifierFlags: value.TypeModifierFlags,
         Address: value.Address,
         CustomUIVisualizers: null,
         ExternalModules: null,
         DataItem: dataItem);
 }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:40,代码来源:TypeVariablesExpansion.cs


示例14: GetRows

        internal override void GetRows(
            ResultProvider resultProvider,
            ArrayBuilder<EvalResult> rows,
            DkmInspectionContext inspectionContext,
            EvalResultDataItem parent,
            DkmClrValue value,
            int startIndex,
            int count,
            bool visitAll,
            ref int index)
        {
            int startIndex2;
            int count2;
            GetIntersection(startIndex, count, index, _count, out startIndex2, out count2);

            int offset = startIndex2 - index;
            for (int i = 0; i < count2; i++)
            {
                rows.Add(GetRow(resultProvider, inspectionContext, value, i + offset, parent));
            }

            index += _count;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:23,代码来源:ArrayExpansion.cs


示例15: GetRow

        private EvalResultDataItem GetRow(
            ResultProvider resultProvider,
            DkmInspectionContext inspectionContext,
            DkmClrValue comObject,
            EvalResultDataItem parent)
        {
            try
            {
                inspectionContext.RuntimeInstance.Process.GetNativeRuntimeInstance();
            }
            catch (DkmException)
            {
                // Native View requires native debugging to be enabled.
                return new EvalResultDataItem(Resources.NativeView, Resources.NativeViewNotNativeDebugging);
            }

            var name = "(IUnknown*)0x" + string.Format(IntPtr.Size == 4 ? "{0:x8}" : "{0:x16}", comObject.NativeComPointer);
            var fullName = "{C++}" + name;

            return new EvalResultDataItem(
                ExpansionKind.NativeView,
                name: name,
                typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                declaredTypeAndInfo: new TypeAndCustomInfo(comObject.Type), // DkmClrValue types don't have attributes.
                parent: null,
                value: comObject,
                displayValue: null,
                expansion: this,
                childShouldParenthesize: false,
                fullName: fullName,
                childFullNamePrefixOpt: fullName,
                formatSpecifiers: Formatter.NoFormatSpecifiers,
                category: DkmEvaluationResultCategory.Data,
                flags: DkmEvaluationResultFlags.ReadOnly,
                editableValue: null,
                inspectionContext: inspectionContext);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:37,代码来源:NativeViewExpansion.cs


示例16: GetRows

        internal override void GetRows(
            ResultProvider resultProvider,
            ArrayBuilder<EvalResult> rows,
            DkmInspectionContext inspectionContext,
            EvalResultDataItem parent,
            DkmClrValue value,
            int startIndex,
            int count,
            bool visitAll,
            ref int index)
        {
            var fields = GetFields();
            var defaultView = fields.DefaultView;

            int startIndex2;
            int count2;
            GetIntersection(startIndex, count, index, defaultView.Count, out startIndex2, out count2);

            int offset = startIndex2 - index;
            for (int i = 0; i < count2; i++)
            {
                var row = GetMemberRow(resultProvider, inspectionContext, value, defaultView[i + offset], parent, _cardinality);
                rows.Add(row);
            }

            index += defaultView.Count;

            if (fields.IncludeRawView)
            {
                if (InRange(startIndex, count, index))
                {
                    rows.Add(this.CreateRawViewRow(resultProvider, inspectionContext, parent, value));
                }

                index++;
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:37,代码来源:TupleExpansion.cs


示例17: GetRow

        private static EvalResultDataItem GetRow(
            ResultProvider resultProvider,
            DkmInspectionContext inspectionContext,
            DkmClrValue pointer,
            TypeAndCustomInfo elementTypeAndInfo,
            EvalResultDataItem parent)
        {
            var value = pointer.Dereference(inspectionContext);
            var wasExceptionThrown = value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown);

            var expansion = wasExceptionThrown ?
                null :
                resultProvider.GetTypeExpansion(inspectionContext, elementTypeAndInfo, value, ExpansionFlags.None);
            var parentFullName = parent.ChildFullNamePrefix;
            var fullName = parentFullName == null ? null : $"*{parentFullName}";
            var editableValue = resultProvider.Formatter.GetEditableValue(value, inspectionContext);

            // NB: Full name is based on the real (i.e. not DebuggerDisplay) name.  This is a change from dev12, 
            // which used the DebuggerDisplay name, causing surprising results in "Add Watch" scenarios.
            return new EvalResultDataItem(
                ExpansionKind.PointerDereference,
                name: fullName ?? $"*{parent.Name}",
                typeDeclaringMemberAndInfo: default(TypeAndCustomInfo),
                declaredTypeAndInfo: elementTypeAndInfo,
                parent: null,
                value: value,
                displayValue: wasExceptionThrown ? string.Format(Resources.InvalidPointerDereference, fullName ?? parent.Name) : null,
                expansion: expansion,
                childShouldParenthesize: true,
                fullName: fullName,
                childFullNamePrefixOpt: fullName,
                formatSpecifiers: Formatter.NoFormatSpecifiers,
                category: DkmEvaluationResultCategory.Other,
                flags: DkmEvaluationResultFlags.None,
                editableValue: editableValue,
                inspectionContext: inspectionContext);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:37,代码来源:PointerDereferenceExpansion.cs


示例18: GetChildrenAndContinue

 private void GetChildrenAndContinue(EvalResultDataItem dataItem, DkmWorkList workList, DkmStackWalkFrame stackFrame, int initialRequestSize, DkmInspectionContext inspectionContext, DkmCompletionRoutine<DkmGetChildrenAsyncResult> completionRoutine)
 {
     var expansion = dataItem.Expansion;
     var rows = ArrayBuilder<EvalResultDataItem>.GetInstance();
     int index = 0;
     if (expansion != null)
     {
         expansion.GetRows(this, rows, inspectionContext, dataItem, dataItem.Value, 0, initialRequestSize, visitAll: true, index: ref index);
     }
     var numRows = rows.Count;
     Debug.Assert(index >= numRows);
     Debug.Assert(initialRequestSize >= numRows);
     var initialChildren = new DkmEvaluationResult[numRows];
     var wl = new WorkList(workList, e => completionRoutine(DkmGetChildrenAsyncResult.CreateErrorResult(e)));
     GetEvaluationResultsAndContinue(rows, initialChildren, 0, numRows, wl, inspectionContext, stackFrame,
         () => wl.ContinueWith(
             () =>
             {
                 var enumContext = DkmEvaluationResultEnumContext.Create(index, stackFrame, inspectionContext, new EnumContextDataItem(dataItem));
                 completionRoutine(new DkmGetChildrenAsyncResult(initialChildren, enumContext));
                 rows.Free();
             }));
     wl.Execute();
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:24,代码来源:ResultProvider.cs


示例19: GetResult

        private DkmEvaluationResult GetResult(
            DkmInspectionContext inspectionContext,
            EvalResultDataItem dataItem,
            DkmClrType declaredType,
            DkmClrCustomTypeInfo declaredTypeInfo,
            string displayName,
            string displayValue,
            string displayType,
            EvalResultDataItem parent)
        {
            var name = dataItem.Name;
            Debug.Assert(name != null);
            var typeDeclaringMemberAndInfo = dataItem.TypeDeclaringMemberAndInfo;

            // Note: Don't respect the debugger display name on the root element:
            //   1) In the Watch window, that's where the user's text goes.
            //   2) In the Locals window, that's where the local name goes.
            // Note: Dev12 respects the debugger display name in the Locals window,
            // but not in the Watch window, but we can't distinguish and this 
            // behavior seems reasonable.
            if (displayName != null && parent != null)
            {
                name = displayName;
            }
            else if (typeDeclaringMemberAndInfo.Type != null)
            {
                bool unused;
                if (typeDeclaringMemberAndInfo.Type.IsInterface)
                {
                    var interfaceTypeName = this.Formatter.GetTypeName(typeDeclaringMemberAndInfo, escapeKeywordIdentifiers: true, sawInvalidIdentifier: out unused);
                    name = string.Format("{0}.{1}", interfaceTypeName, name);
                }
                else
                {
                    var pooled = PooledStringBuilder.GetInstance();
                    var builder = pooled.Builder;
                    builder.Append(name);
                    builder.Append(" (");
                    builder.Append(this.Formatter.GetTypeName(typeDeclaringMemberAndInfo, escapeKeywordIdentifiers: false, sawInvalidIdentifier: out unused));
                    builder.Append(')');
                    name = pooled.ToStringAndFree();
                }
            }

            var value = dataItem.Value;
            string display;
            if (value.HasExceptionThrown())
            {
                display = dataItem.DisplayValue ?? value.GetExceptionMessage(dataItem.FullNameWithoutFormatSpecifiers ?? dataItem.Name, this.Formatter);
            }
            else if (displayValue != null)
            {
                display = value.IncludeObjectId(displayValue);
            }
            else
            {
                display = value.GetValueString(inspectionContext, Formatter.NoFormatSpecifiers);
            }

            var typeName = displayType ?? GetTypeName(inspectionContext, value, declaredType, declaredTypeInfo, dataItem.Kind);

            return CreateEvaluationResult(inspectionContext, value, name, typeName, display, dataItem);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:63,代码来源:ResultProvider.cs


示例20: GetResultAndContinue

        private void GetResultAndContinue(
            EvalResultDataItem dataItem,
            WorkList workList,
            DkmClrType declaredType,
            DkmClrCustomTypeInfo declaredTypeInfo,
            DkmInspectionContext inspectionContext,
            EvalResultDataItem parent,
            CompletionRoutine<DkmEvaluationResult> completionRoutine)
        {
            var value = dataItem.Value; // Value may have been replaced (specifically, for Nullable<T>).
            DebuggerDisplayInfo displayInfo;
            if (value.TryGetDebuggerDisplayInfo(out displayInfo))
            {
                var targetType = displayInfo.TargetType;
                var attribute = displayInfo.Attribute;
                CompletionRoutine<Exception> onException =
                    e => completionRoutine(CreateEvaluationResultFromException(e, dataItem, inspectionContext));

                EvaluateDebuggerDisplayStringAndContinue(value, workList, inspectionContext, targetType, attribute.Name,
                    displayName => EvaluateDebuggerDisplayStringAndContinue(value, workList, inspectionContext, targetType, attribute.Value,
                        displayValue => EvaluateDebuggerDisplayStringAndContinue(value, workList, inspectionContext, targetType, attribute.TypeName,
                            displayType =>
                            {
                                completionRoutine(GetResult(inspectionContext, dataItem, declaredType, declaredTypeInfo, displayName.Result, displayValue.Result, displayType.Result, parent));
                            },
                            onException),
                        onException),
                    onException);
            }
            else
            {
                completionRoutine(GetResult(inspectionContext, dataItem, declaredType, declaredTypeInfo, displayName: null, displayValue: null, displayType: null, parent: parent));
            }
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:34,代码来源:ResultProvider.cs



注:本文中的Microsoft.CodeAnalysis.ExpressionEvaluator.EvalResultDataItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Scripting.ScriptOptions类代码示例发布时间:2022-05-26
下一篇:
C# Emit.EmitContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap