本文整理汇总了C#中Microsoft.VisualStudio.Debugger.Clr.DkmClrType类的典型用法代码示例。如果您正苦于以下问题:C# DkmClrType类的具体用法?C# DkmClrType怎么用?C# DkmClrType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DkmClrType类属于Microsoft.VisualStudio.Debugger.Clr命名空间,在下文中一共展示了DkmClrType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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)))));
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:28,代码来源:ResultProvider.cs
示例2: 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);
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:38,代码来源:ResultsViewExpansion.cs
示例3: 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;
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:Formatter.cs
示例4: DkmClrValue
internal DkmClrValue(
object value,
object hostObjectValue,
DkmClrType type,
string alias,
DkmEvaluationResultFlags evalFlags,
DkmClrValueFlags valueFlags,
DkmEvaluationResultCategory category = default(DkmEvaluationResultCategory),
DkmEvaluationResultAccessType access = default(DkmEvaluationResultAccessType),
ulong nativeComPointer = 0)
{
Debug.Assert((type == null) || !type.GetLmrType().IsTypeVariables() || (valueFlags == DkmClrValueFlags.Synthetic));
Debug.Assert((alias == null) || evalFlags.Includes(DkmEvaluationResultFlags.HasObjectId));
// The "real" DkmClrValue will always have a value of zero for null pointers.
Debug.Assert((type == null) || !type.GetLmrType().IsPointer || (value != null));
this.RawValue = value;
this.HostObjectValue = hostObjectValue;
this.Type = type;
this.Alias = alias;
this.EvalFlags = evalFlags;
this.ValueFlags = valueFlags;
this.Category = category;
this.Access = access;
this.NativeComPointer = nativeComPointer;
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:26,代码来源:DkmClrValue.cs
示例5: MultipleExpansions
public void MultipleExpansions()
{
var expression = "o";
dynamic o = new ExpandoObject();
o.Answer = 42;
var type = new DkmClrType((TypeImpl)o.GetType());
var value = CreateDkmClrValue((object)o, type);
// Dynamic View should appear after all other expansions.
var result = FormatResult(expression, value);
Verify(result,
EvalResult(expression, "{System.Dynamic.ExpandoObject}", "System.Dynamic.ExpandoObject", expression, DkmEvaluationResultFlags.Expandable));
Verify(GetChildren(result),
EvalResult("Class", "{System.Dynamic.ExpandoClass}", "System.Dynamic.ExpandoClass", "o.Class", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Internal),
EvalResult("LockObject", "{object}", "object", "o.LockObject", DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Data, DkmEvaluationResultAccessType.Internal),
EvalResult("System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, object>>.Count", "1", "int", "((System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, object>>)o).Count", DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Private),
EvalResult("System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, object>>.IsReadOnly", "false", "bool", "((System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string, object>>)o).IsReadOnly", DkmEvaluationResultFlags.Boolean | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Private),
EvalResult("System.Collections.Generic.IDictionary<string, object>.Keys", "Count = 1", "System.Collections.Generic.ICollection<string> {System.Dynamic.ExpandoObject.KeyCollection}", "((System.Collections.Generic.IDictionary<string, object>)o).Keys", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Private),
EvalResult("System.Collections.Generic.IDictionary<string, object>.Values", "Count = 1", "System.Collections.Generic.ICollection<object> {System.Dynamic.ExpandoObject.ValueCollection}", "((System.Collections.Generic.IDictionary<string, object>)o).Values", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Property, DkmEvaluationResultAccessType.Private),
EvalResult("_count", "1", "int", "o._count", category: DkmEvaluationResultCategory.Data, access: DkmEvaluationResultAccessType.Private),
EvalResult("_data", "{System.Dynamic.ExpandoObject.ExpandoData}", "System.Dynamic.ExpandoObject.ExpandoData", "o._data", DkmEvaluationResultFlags.Expandable, DkmEvaluationResultCategory.Data, DkmEvaluationResultAccessType.Private),
EvalResult("_propertyChanged", "null", "System.ComponentModel.PropertyChangedEventHandler", "o._propertyChanged", category: DkmEvaluationResultCategory.Data, access: DkmEvaluationResultAccessType.Private),
EvalResult(Resources.StaticMembers, null, "", "System.Dynamic.ExpandoObject", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Class),
EvalResult(Resources.DynamicView, Resources.DynamicViewValueWarning, "", "o, dynamic", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
}
开发者ID:hyldrim,项目名称:roslyn,代码行数:26,代码来源:DynamicViewTests.cs
示例6: MakeGenericType
internal DkmClrType MakeGenericType(params DkmClrType[] genericArguments)
{
var type = new DkmClrType(
_module,
_appDomain,
_lmrType.MakeGenericType(genericArguments.Select(t => t._lmrType).ToArray()));
type._lazyGenericArguments = new ReadOnlyCollection<DkmClrType>(genericArguments);
return type;
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:9,代码来源:DkmClrType.cs
示例7: GetCastExpression
string IDkmClrFullNameProvider.GetClrCastExpression(DkmInspectionContext inspectionContext, string argument, DkmClrType type, DkmClrCustomTypeInfo customTypeInfo, bool parenthesizeArgument, bool parenthesizeEntireExpression)
{
bool sawInvalidIdentifier;
var name = GetTypeName(new TypeAndCustomInfo(type, customTypeInfo), escapeKeywordIdentifiers: true, sawInvalidIdentifier: out sawInvalidIdentifier);
if (sawInvalidIdentifier)
{
return null;
}
return GetCastExpression(argument, name, parenthesizeArgument, parenthesizeEntireExpression);
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:10,代码来源:Formatter.cs
示例8: GetResult
internal DkmEvaluationResult GetResult(DkmClrValue value, DkmClrType declaredType, ReadOnlyCollection<string> formatSpecifiers, string resultName, string resultFullName)
{
// TODO: Use full name
try
{
return GetRootResult(value, declaredType, resultName);
}
catch (Exception e) when (ExpressionEvaluatorFatalError.CrashIfFailFastEnabled(e))
{
throw ExceptionUtilities.Unreachable;
}
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:12,代码来源:ResultProvider.cs
示例9: GetTypeName
public static string GetTypeName(this System.Type type, DkmClrCustomTypeInfo typeInfo, bool escapeKeywordIdentifiers = false, DkmInspectionContext inspectionContext = null)
{
var formatter = new CSharpFormatter();
var clrType = new DkmClrType((TypeImpl)type);
if (inspectionContext == null)
{
var inspectionSession = new DkmInspectionSession(ImmutableArray.Create<IDkmClrFormatter>(formatter), ImmutableArray.Create<IDkmClrResultProvider>(new CSharpResultProvider()));
inspectionContext = new DkmInspectionContext(inspectionSession, DkmEvaluationFlags.None, radix: 10, runtimeInstance: null);
}
return escapeKeywordIdentifiers ?
((IDkmClrFullNameProvider)formatter).GetClrTypeName(inspectionContext, clrType, typeInfo) :
inspectionContext.GetTypeName(clrType, typeInfo, Formatter.NoFormatSpecifiers);
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:13,代码来源:TestTypeExtensions.cs
示例10: WorkList
void IDkmClrResultProvider.GetResult(DkmClrValue value, DkmWorkList workList, DkmClrType declaredType, DkmClrCustomTypeInfo declaredTypeInfo, DkmInspectionContext inspectionContext, ReadOnlyCollection<string> formatSpecifiers, string resultName, string resultFullName, DkmCompletionRoutine<DkmEvaluationAsyncResult> completionRoutine)
{
// TODO: Use full name
var wl = new WorkList(workList, e => completionRoutine(DkmEvaluationAsyncResult.CreateErrorResult(e)));
GetRootResultAndContinue(
value,
wl,
declaredType,
declaredTypeInfo,
inspectionContext,
resultName,
result => wl.ContinueWith(() => completionRoutine(new DkmEvaluationAsyncResult(result))));
wl.Execute();
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:14,代码来源:ResultProvider.cs
示例11: CreateResultsOnlyRow
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);
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:48,代码来源:ResultsViewExpansion.cs
示例12: 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
示例13: GetType
internal DkmClrType GetType(string typeName, params System.Type[] typeArguments)
{
foreach (var module in this.Modules)
{
var assembly = module.Assembly;
var type = assembly.GetType(typeName);
if (type != null)
{
var result = new DkmClrType(module, _appDomain, (TypeImpl)type);
if (typeArguments.Length > 0)
{
result = result.MakeGenericType(typeArguments.Select(this.GetType).ToArray());
}
return result;
}
}
return null;
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:18,代码来源:DkmClrRuntimeInstance.cs
示例14: ExceptionTypeMember
public void ExceptionTypeMember()
{
var expression = "o";
dynamic o = new ExpandoObject();
var exception = new NotImplementedException();
o.Member = exception;
var type = new DkmClrType((TypeImpl)o.GetType());
var value = CreateDkmClrValue((object)o, type);
var result = FormatResult(expression, value);
Verify(result,
EvalResult(expression, "{System.Dynamic.ExpandoObject}", "System.Dynamic.ExpandoObject", expression, DkmEvaluationResultFlags.Expandable));
var dynamicView = GetChildren(result).Last();
Verify(dynamicView,
EvalResult(Resources.DynamicView, Resources.DynamicViewValueWarning, "", "o, dynamic", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly));
Verify(GetChildren(dynamicView),
EvalResult("Member", $"{{{exception.ToString()}}}", "System.NotImplementedException", "new Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView(o).Items[0]", DkmEvaluationResultFlags.ReadOnly));
}
开发者ID:hyldrim,项目名称:roslyn,代码行数:19,代码来源:DynamicViewTests.cs
示例15:
/// <summary>
/// This method is called by the debug engine to populate the text representing the type of
/// a result.
/// </summary>
/// <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="clrType">This is the raw type we want to format</param>
/// <param name="customTypeInfo">If Expression Compiler passed any additional information
/// about the type that doesn't exist in metadata, this parameter contais that information.</param>
/// <param name="formatSpecifiers">A list of custom format specifiers that the debugger did
/// not understand. If you want special format specifiers for your language, handle them
/// here. The formatter should ignore any format specifiers it does not understand.</param>
/// <returns>The text of the type name to display</returns>
string IDkmClrFormatter.GetTypeName(
DkmInspectionContext inspectionContext,
DkmClrType clrType,
DkmClrCustomTypeInfo customTypeInfo,
ReadOnlyCollection<string> formatSpecifiers)
{
// Get the LMR type for the DkmClrType. LMR Types (Microsoft.VisualStudio.Debugger.Metadata.Type)
// are similar to System.Type, but represent types that live in the process being debugged.
Type lmrType = clrType.GetLmrType();
IrisType irisType = Utility.GetIrisTypeForLmrType(lmrType);
if (irisType == IrisType.Invalid)
{
// We don't know about this type. Delegate to the C# Formatter to format the
// type name.
return inspectionContext.GetTypeName(clrType, customTypeInfo, formatSpecifiers);
}
return irisType.ToString();
}
开发者ID:OToL,项目名称:ConcordExtensibilitySamples,代码行数:35,代码来源:IrisFormatter.cs
示例16: SpecialTypes
public void SpecialTypes()
{
var objectType = new DkmClrType((TypeImpl)typeof(object));
DkmClrValue value;
// int
value = CreateDkmClrValue(value: 1, type: typeof(int), alias: "$1", evalFlags: DkmEvaluationResultFlags.HasObjectId);
Verify(
FormatResult("i", value, objectType),
EvalResult("i", "1 {$1}", "object {int}", "i", DkmEvaluationResultFlags.HasObjectId));
// char
value = CreateDkmClrValue(value: 'c', type: typeof(char), alias: "$2", evalFlags: DkmEvaluationResultFlags.HasObjectId);
Verify(
FormatResult("c", value, objectType),
EvalResult("c", "99 'c' {$2}", "object {char}", "c", DkmEvaluationResultFlags.HasObjectId, editableValue: "'c'"));
// char (hex)
value = CreateDkmClrValue(value: 'c', type: typeof(char), alias: "$3", evalFlags: DkmEvaluationResultFlags.HasObjectId);
Verify(
FormatResult("c", value, objectType, inspectionContext: CreateDkmInspectionContext(radix: 16)),
EvalResult("c", "0x0063 'c' {$3}", "object {char}", "c", DkmEvaluationResultFlags.HasObjectId, editableValue: "'c'"));
// enum
value = CreateDkmClrValue(value: DkmEvaluationResultFlags.HasObjectId, type: typeof(DkmEvaluationResultFlags), alias: "$Four", evalFlags: DkmEvaluationResultFlags.HasObjectId);
Verify(
FormatResult("e", value, objectType),
EvalResult("e", "HasObjectId {$Four}", "object {Microsoft.VisualStudio.Debugger.Evaluation.DkmEvaluationResultFlags}", "e", DkmEvaluationResultFlags.HasObjectId, editableValue: "Microsoft.VisualStudio.Debugger.Evaluation.DkmEvaluationResultFlags.HasObjectId"));
// string
value = CreateDkmClrValue(value: "str", type: typeof(string), alias: "$5", evalFlags: DkmEvaluationResultFlags.HasObjectId);
Verify(
FormatResult("s", value),
EvalResult("s", "\"str\" {$5}", "string", "s", DkmEvaluationResultFlags.RawString | DkmEvaluationResultFlags.HasObjectId, editableValue: "\"str\""));
// decimal
value = CreateDkmClrValue(value: 6m, type: typeof(decimal), alias: "$6", evalFlags: DkmEvaluationResultFlags.HasObjectId);
Verify(
FormatResult("d", value, objectType),
EvalResult("d", "6 {$6}", "object {decimal}", "d", DkmEvaluationResultFlags.HasObjectId, editableValue: "6M"));
// array
value = CreateDkmClrValue(value: new int[] { 1, 2 }, type: typeof(int[]), alias: "$7", evalFlags: DkmEvaluationResultFlags.HasObjectId);
Verify(
FormatResult("a", value, objectType),
EvalResult("a", "{int[2]} {$7}", "object {int[]}", "a", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.HasObjectId));
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:40,代码来源:ObjectIdTests.cs
示例17: MultipleMembers
public void MultipleMembers()
{
var expression = "o";
dynamic o = new ExpandoObject();
o.Philosophers = new object[] { "Pythagoras", "Lucretius", "Zeno" };
o.WhatsForDinner = "Crab Cakes";
o.NumForks = 2;
var type = new DkmClrType((TypeImpl)o.GetType());
var value = CreateDkmClrValue((object)o, type);
var result = FormatResult(expression, value);
Verify(result,
EvalResult(expression, "{System.Dynamic.ExpandoObject}", "System.Dynamic.ExpandoObject", expression, DkmEvaluationResultFlags.Expandable));
var dynamicView = GetChildren(result).Last();
Verify(dynamicView,
EvalResult(Resources.DynamicView, Resources.DynamicViewValueWarning, "", "o, dynamic", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly));
Verify(GetChildren(dynamicView),
EvalResult("NumForks", "2", "System.Int32", "new Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView(o).Items[0]", DkmEvaluationResultFlags.ReadOnly),
EvalResult("Philosophers", "{object[3]}", "System.Object[]", "new Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView(o).Items[1]", DkmEvaluationResultFlags.ReadOnly),
EvalResult("WhatsForDinner", "\"Crab Cakes\"", "System.String", "new Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView(o).Items[2]", DkmEvaluationResultFlags.ReadOnly));
}
开发者ID:hyldrim,项目名称:roslyn,代码行数:22,代码来源:DynamicViewTests.cs
示例18: DkmClrValue
internal DkmClrValue(
object value,
object hostObjectValue,
DkmClrType type,
string alias,
IDkmClrFormatter formatter,
DkmEvaluationResultFlags evalFlags,
DkmClrValueFlags valueFlags,
DkmInspectionContext inspectionContext)
{
Debug.Assert(!type.GetLmrType().IsTypeVariables() || (valueFlags == DkmClrValueFlags.Synthetic));
Debug.Assert((alias == null) || evalFlags.Includes(DkmEvaluationResultFlags.HasObjectId));
// The "real" DkmClrValue will always have a value of zero for null pointers.
Debug.Assert(!type.GetLmrType().IsPointer || (value != null));
_rawValue = value;
this.HostObjectValue = hostObjectValue;
this.Type = type;
_formatter = formatter;
this.Alias = alias;
this.EvalFlags = evalFlags;
this.ValueFlags = valueFlags;
this.InspectionContext = inspectionContext ?? new DkmInspectionContext(formatter, DkmEvaluationFlags.None, 10);
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:24,代码来源:DkmClrValue.cs
示例19: GetTypeName
/// <returns>
/// The qualified name (i.e. including containing types and namespaces) of a named, pointer,
/// or array type followed by the qualified name of the actual runtime type, if provided.
/// </returns>
private static string GetTypeName(DkmInspectionContext inspectionContext, DkmClrValue value, DkmClrType declaredType, DkmClrCustomTypeInfo declaredTypeInfo, ExpansionKind kind)
{
var declaredLmrType = declaredType.GetLmrType();
var runtimeType = value.Type;
var runtimeLmrType = runtimeType.GetLmrType();
var declaredTypeName = inspectionContext.GetTypeName(declaredType, declaredTypeInfo, Formatter.NoFormatSpecifiers);
var runtimeTypeName = inspectionContext.GetTypeName(runtimeType, CustomTypeInfo: null, FormatSpecifiers: Formatter.NoFormatSpecifiers);
var includeRuntimeTypeName =
!string.Equals(declaredTypeName, runtimeTypeName, StringComparison.OrdinalIgnoreCase) && // Names will reflect "dynamic", types will not.
!declaredLmrType.IsPointer &&
(kind != ExpansionKind.PointerDereference) &&
(!declaredLmrType.IsNullable() || value.EvalFlags.Includes(DkmEvaluationResultFlags.ExceptionThrown));
return includeRuntimeTypeName ?
string.Format("{0} {{{1}}}", declaredTypeName, runtimeTypeName) :
declaredTypeName;
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:20,代码来源:ResultProvider.cs
示例20: Dereference
public DkmClrValue Dereference(DkmInspectionContext inspectionContext)
{
if (inspectionContext == null)
{
throw new ArgumentNullException(nameof(inspectionContext));
}
if (RawValue == null)
{
throw new InvalidOperationException("Cannot dereference invalid value");
}
var elementType = this.Type.GetLmrType().GetElementType();
var evalFlags = DkmEvaluationResultFlags.None;
var valueFlags = DkmClrValueFlags.None;
object value;
try
{
var intPtr = Environment.Is64BitProcess ? new IntPtr((long)RawValue) : new IntPtr((int)RawValue);
value = Dereference(intPtr, elementType);
}
catch (Exception e)
{
value = e;
evalFlags |= DkmEvaluationResultFlags.ExceptionThrown;
}
var valueType = new DkmClrType(this.Type.RuntimeInstance, (value == null || elementType.IsPointer) ? elementType : (TypeImpl)value.GetType());
return new DkmClrValue(
value,
value,
valueType,
alias: null,
evalFlags: evalFlags,
valueFlags: valueFlags,
category: DkmEvaluationResultCategory.Other,
access: DkmEvaluationResultAccessType.None);
}
开发者ID:XieShuquan,项目名称:roslyn,代码行数:36,代码来源:DkmClrValue.cs
注:本文中的Microsoft.VisualStudio.Debugger.Clr.DkmClrType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论