当前位置: 首页>>代码示例>>C#>>正文


C# ExpressionEvaluator.EvalResultDataItem类代码示例

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


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


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