示例#1
0
        internal static EvalResult CreateResultsOnlyRow(
            DkmInspectionContext inspectionContext,
            string name,
            string fullName,
            ReadOnlyCollection <string> formatSpecifiers,
            DkmClrType declaredType,
            DkmClrCustomTypeInfo declaredTypeInfo,
            DkmClrValue value,
            ResultProvider resultProvider
            )
        {
            string errorMessage;

            if (value.IsError())
            {
                errorMessage = (string)value.HostObjectValue;
            }
            else if (value.HasExceptionThrown())
            {
                errorMessage = value.GetExceptionMessage(inspectionContext, name);
            }
            else
            {
                var enumerableType = GetEnumerableType(value);
                if (enumerableType != null)
                {
                    var expansion = CreateExpansion(
                        inspectionContext,
                        value,
                        enumerableType,
                        resultProvider
                        );
                    if (expansion != null)
                    {
                        return(expansion.CreateResultsViewRow(
                                   inspectionContext,
                                   name,
                                   fullName,
                                   formatSpecifiers,
                                   new TypeAndCustomInfo(declaredType, declaredTypeInfo),
                                   value,
                                   includeResultsFormatSpecifier: true,
                                   fullNameProvider: resultProvider.FullNameProvider
                                   ));
                    }
                    errorMessage = Resources.ResultsViewNoSystemCore;
                }
                else
                {
                    errorMessage = Resources.ResultsViewNotEnumerable;
                }
            }

            Debug.Assert(errorMessage != null);
            return(new EvalResult(name, errorMessage, inspectionContext));
        }
        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));
        }
示例#3
0
        internal static EvalResultDataItem CreateResultsOnlyRow(
            DkmInspectionContext inspectionContext,
            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(inspectionContext, value, enumerableType, formatter);
                    if (expansion != null)
                    {
                        return(expansion.CreateResultsViewRow(inspectionContext, name, parent, formatter));
                    }
                    errorMessage = Resources.ResultsViewNoSystemCore;
                }
                else
                {
                    errorMessage = Resources.ResultsViewNotEnumerable;
                }
            }

            Debug.Assert(errorMessage != null);
            return(new EvalResultDataItem(name, errorMessage));
        }