本文整理汇总了C#中Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation.DkmClrValue.Dereference方法的典型用法代码示例。如果您正苦于以下问题:C# DkmClrValue.Dereference方法的具体用法?C# DkmClrValue.Dereference怎么用?C# DkmClrValue.Dereference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation.DkmClrValue
的用法示例。
在下文中一共展示了DkmClrValue.Dereference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}