本文整理汇总了C#中Microsoft.VisualStudio.Debugger.Evaluation.DkmInspectionContext类的典型用法代码示例。如果您正苦于以下问题:C# DkmInspectionContext类的具体用法?C# DkmInspectionContext怎么用?C# DkmInspectionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DkmInspectionContext类属于Microsoft.VisualStudio.Debugger.Evaluation命名空间,在下文中一共展示了DkmInspectionContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateResultsOnlyRowIfSynthesizedEnumerable
/// <summary>
/// Generate a Results Only row if the value is a synthesized
/// value declared as IEnumerable or IEnumerable<T>.
/// </summary>
internal static EvalResultDataItem CreateResultsOnlyRowIfSynthesizedEnumerable(
DkmInspectionContext inspectionContext,
string name,
DkmClrType declaredType,
DkmClrCustomTypeInfo declaredTypeInfo,
DkmClrValue value,
Formatter formatter)
{
if ((value.ValueFlags & DkmClrValueFlags.Synthetic) == 0)
{
return null;
}
// Must be declared as IEnumerable or IEnumerable<T>, not a derived type.
var enumerableType = GetEnumerableType(value, declaredType, requireExactInterface: true);
if (enumerableType == null)
{
return null;
}
var expansion = CreateExpansion(inspectionContext, value, enumerableType, formatter);
if (expansion == null)
{
return null;
}
return expansion.CreateResultsViewRow(
inspectionContext,
name,
new TypeAndCustomInfo(declaredType.GetLmrType(), declaredTypeInfo),
value,
includeResultsFormatSpecifier: false,
formatter: formatter);
}
示例2: 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;
}
示例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);
}
示例4: using
/// <summary>
/// This method is called by the debug engine to compile an expression that the user wants
/// to evaluate. Before the call, we have the text of the expression and information about
/// the context we want to evaluate in (code location, evaluation flags, etc.). The result
/// of the call is a "query" containing IL the debugger will execute to get the
/// result of the expression.
/// </summary>
/// <param name="expression">This is the raw expression to compile</param>
/// <param name="instructionAddress">Instruction address or code location to use as the
/// context of the compilation.</param>
/// <param name="inspectionContext">Context of the evaluation. This contains options/flags
/// to be used during compilation. It also contains the InspectionSession. The inspection
/// session is the object that provides lifetime management for our objects. When the user
/// steps or continues the process, the debug engine will dispose of the inspection session</param>
/// <param name="error">[Out] If the there are any compile errors, this parameter is set to
/// the error message to display to the user</param>
/// <param name="result">[Out] If compilation was successful, this is the output query.</param>
void IDkmClrExpressionCompiler.CompileExpression(
DkmLanguageExpression expression,
DkmClrInstructionAddress instructionAddress,
DkmInspectionContext inspectionContext,
out string error,
out DkmCompiledClrInspectionQuery result)
{
error = null;
result = null;
using (DebugCompilerContext context = ContextFactory.CreateExpressionContext(inspectionContext, instructionAddress, expression.Text))
{
context.GenerateQuery();
error = context.FirstError;
if (string.IsNullOrEmpty(error))
{
result = DkmCompiledClrInspectionQuery.Create(
instructionAddress.RuntimeInstance,
null,
expression.Language.Id,
new ReadOnlyCollection<byte>(context.GetPeBytes()),
context.ClassName,
context.MethodName,
new ReadOnlyCollection<string>(context.FormatSpecifiers),
context.ResultFlags,
DkmEvaluationResultCategory.Data,
DkmEvaluationResultAccessType.None,
DkmEvaluationResultStorageType.None,
DkmEvaluationResultTypeModifierFlags.None,
null);
}
}
}
示例5: DkmSuccessEvaluationResult
private DkmSuccessEvaluationResult(
DkmInspectionContext inspectionContext,
DkmStackWalkFrame stackFrame,
string name,
string fullName,
DkmEvaluationResultFlags flags,
string value,
string editableValue,
string type,
DkmEvaluationResultCategory category,
DkmEvaluationResultAccessType access,
DkmEvaluationResultStorageType storageType,
DkmEvaluationResultTypeModifierFlags typeModifierFlags,
DkmDataAddress address,
ReadOnlyCollection<DkmCustomUIVisualizerInfo> customUIVisualizers,
ReadOnlyCollection<DkmModuleInstance> externalModules,
DkmDataItem dataItem) :
base(inspectionContext, stackFrame, name, fullName, flags, type, dataItem)
{
this.Value = value;
this.EditableValue = editableValue;
this.Category = category;
this.Access = access;
this.StorageType = storageType;
this.TypeModifierFlags = typeModifierFlags;
this.CustomUIVisualizers = customUIVisualizers;
}
示例6: foreach
void IDkmClrResultProvider.GetResult(DkmClrValue value, DkmWorkList workList, DkmClrType declaredType, DkmClrCustomTypeInfo declaredTypeInfo, DkmInspectionContext inspectionContext, ReadOnlyCollection<string> formatSpecifiers, string resultName, string resultFullName, DkmCompletionRoutine<DkmEvaluationAsyncResult> completionRoutine)
{
if (formatSpecifiers == null)
{
formatSpecifiers = Formatter.NoFormatSpecifiers;
}
if (resultFullName != null)
{
ReadOnlyCollection<string> otherSpecifiers;
resultFullName = FullNameProvider.GetClrExpressionAndFormatSpecifiers(inspectionContext, resultFullName, out otherSpecifiers);
foreach (var formatSpecifier in otherSpecifiers)
{
formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, formatSpecifier);
}
}
var wl = new WorkList(workList, e => completionRoutine(DkmEvaluationAsyncResult.CreateErrorResult(e)));
wl.ContinueWith(
() => GetRootResultAndContinue(
value,
wl,
declaredType,
declaredTypeInfo,
inspectionContext,
resultName,
resultFullName,
formatSpecifiers,
result => wl.ContinueWith(() => completionRoutine(new DkmEvaluationAsyncResult(result)))));
}
示例7: GetTypeName
string IDkmClrFullNameProvider.GetClrTypeName(DkmInspectionContext inspectionContext, DkmClrType clrType, DkmClrCustomTypeInfo customTypeInfo)
{
Debug.Assert(inspectionContext != null);
bool sawInvalidIdentifier;
var name = GetTypeName(new TypeAndCustomInfo(clrType, customTypeInfo), escapeKeywordIdentifiers: true, sawInvalidIdentifier: out sawInvalidIdentifier);
return sawInvalidIdentifier ? null : name;
}
示例8: CreateExpansion
internal static DynamicViewExpansion CreateExpansion(DkmInspectionContext inspectionContext, DkmClrValue value, ResultProvider resultProvider)
{
if (value.IsError() || value.IsNull || value.HasExceptionThrown())
{
return null;
}
var type = value.Type.GetLmrType();
if (!(type.IsComObject() || type.IsIDynamicMetaObjectProvider()))
{
return null;
}
var proxyValue = value.InstantiateDynamicViewProxy(inspectionContext);
Debug.Assert((proxyValue == null) || (!proxyValue.IsNull && !proxyValue.IsError() && !proxyValue.HasExceptionThrown()));
// InstantiateDynamicViewProxy may return null (if required assembly is missing, for instance).
if (proxyValue == null)
{
return null;
}
// Expansion is based on the 'DynamicMetaObjectProviderDebugView.Items' property.
var proxyType = proxyValue.Type;
var itemsMemberExpansion = RootHiddenExpansion.CreateExpansion(
proxyType.GetMemberByName("Items"),
DynamicFlagsMap.Create(new TypeAndCustomInfo(proxyType)));
return new DynamicViewExpansion(proxyValue, itemsMemberExpansion);
}
示例9: 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);
}
示例10: 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);
}
示例11: catch
DkmCompiledClrLocalsQuery IDkmClrExpressionCompiler.GetClrLocalVariableQuery(
DkmInspectionContext inspectionContext,
DkmClrInstructionAddress instructionAddress,
bool argumentsOnly)
{
try
{
var references = instructionAddress.Process.GetMetadataBlocks(instructionAddress.ModuleInstance.AppDomain);
var context = this.CreateMethodContext(instructionAddress, references);
var builder = ArrayBuilder<LocalAndMethod>.GetInstance();
string typeName;
var assembly = context.CompileGetLocals(
builder,
argumentsOnly,
out typeName,
testData: null);
Debug.Assert((builder.Count == 0) == (assembly.Count == 0));
var locals = new ReadOnlyCollection<DkmClrLocalVariableInfo>(builder.SelectAsArray(l => DkmClrLocalVariableInfo.Create(l.LocalName, l.MethodName, l.Flags, DkmEvaluationResultCategory.Data)));
builder.Free();
return DkmCompiledClrLocalsQuery.Create(inspectionContext.RuntimeInstance, null, this.CompilerId, assembly, typeName, locals);
}
catch (Exception e) when (ExpressionEvaluatorFatalError.CrashIfFailFastEnabled(e))
{
throw ExceptionUtilities.Unreachable;
}
}
示例12: GetValueString
string IDkmClrFormatter.GetValueString(DkmClrValue value, DkmInspectionContext inspectionContext, ReadOnlyCollection<string> formatSpecifiers)
{
var options = ((inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoQuotes) == 0) ?
ObjectDisplayOptions.UseQuotes :
ObjectDisplayOptions.None;
return GetValueString(value, inspectionContext, options, GetValueFlags.IncludeObjectId);
}
示例13: TryGetFrameReturnTypeHelper
private static string TryGetFrameReturnTypeHelper(DkmInspectionContext inspectionContext, DkmStackWalkFrame frame)
{
ImportedMethod currentMethod = TryGetCurrentMethod(inspectionContext, frame);
if (currentMethod == null)
return null;
return currentMethod.ReturnType.ToString();
}
示例14: CreateExpansion
internal static ResultsViewExpansion CreateExpansion(DkmInspectionContext inspectionContext, DkmClrValue value, Formatter formatter)
{
var enumerableType = GetEnumerableType(value);
if (enumerableType == null)
{
return null;
}
return CreateExpansion(inspectionContext, value, enumerableType, formatter);
}
示例15: Create
public static DkmEvaluationResultEnumContext Create(int Count, DkmStackWalkFrame StackFrame, DkmInspectionContext InspectionContext, DkmDataItem DataItem)
{
var enumContext = new DkmEvaluationResultEnumContext(Count, InspectionContext);
if (DataItem != null)
{
enumContext.SetDataItem(DkmDataCreationDisposition.CreateNew, DataItem);
}
return enumContext;
}