當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。