提交 5ca3e03f 编写于 作者: C Charles Stoner

Use actual value and type for ', results' - feedback from PR#1051

上级 c7ca32fe
......@@ -234,7 +234,7 @@ public void ResultsView_FrameworkTypes()
value = CreateDkmClrValue(new System.Collections.ArrayList(new[] { 2 }), type: runtime.GetType(typeof(System.Collections.ArrayList)));
evalResult = FormatResult("a", value, inspectionContext: inspectionContext);
Verify(evalResult,
EvalResult("a", "Expanding the Results View will enumerate the IEnumerable", "", "a, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
EvalResult("a", "Count = 1", "System.Collections.ArrayList", "a, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
var children = GetChildren(evalResult);
Verify(children,
EvalResult("[0]", "2", "object {int}", "new System.Linq.SystemCore_EnumerableDebugView(a).Items[0]"));
......@@ -243,7 +243,7 @@ public void ResultsView_FrameworkTypes()
value = CreateDkmClrValue(new System.Collections.Generic.List<object>(new object[] { 3 }), type: runtime.GetType(typeof(System.Collections.Generic.List<object>)));
evalResult = FormatResult("l", value, inspectionContext: inspectionContext);
Verify(evalResult,
EvalResult("l", "Expanding the Results View will enumerate the IEnumerable", "", "l, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
EvalResult("l", "Count = 1", "System.Collections.Generic.List<object>", "l, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
children = GetChildren(evalResult);
Verify(children,
EvalResult("[0]", "3", "object {int}", "new System.Linq.SystemCore_EnumerableDebugView<object>(l).Items[0]"));
......@@ -276,7 +276,7 @@ public IEnumerator GetEnumerator()
type: type);
var evalResult = FormatResult("o", "o, results, d", value, inspectionContext: CreateDkmInspectionContext(DkmEvaluationFlags.ResultsOnly));
Verify(evalResult,
EvalResult("o", "Expanding the Results View will enumerate the IEnumerable", "", "o, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
EvalResult("o", "{C}", "C", "o, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
var children = GetChildren(evalResult);
// ResultsOnly is not inherited.
Verify(children,
......@@ -316,7 +316,7 @@ IEnumerator IEnumerable.GetEnumerator()
type: type);
var evalResult = FormatResult("o", "o, results", value, inspectionContext: CreateDkmInspectionContext(DkmEvaluationFlags.ResultsOnly));
Verify(evalResult,
EvalResult("o", "Expanding the Results View will enumerate the IEnumerable", "", "o, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
EvalResult("o", "{S<int>}", "S<int>", "o, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
var children = GetChildren(evalResult);
Verify(children,
EvalResult("[0]", "2", "int", "new System.Linq.SystemCore_EnumerableDebugView<int>(o).Items[0]"));
......@@ -406,7 +406,7 @@ public object F
type: type);
var evalResult = FormatResult("o", "o, results", value, inspectionContext: CreateDkmInspectionContext(DkmEvaluationFlags.ResultsOnly));
Verify(evalResult,
EvalResult("o", "Expanding the Results View will enumerate the IEnumerable", "", "o, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
EvalResult("o", "{C}", "C", "o, results", DkmEvaluationResultFlags.Expandable | DkmEvaluationResultFlags.ReadOnly, DkmEvaluationResultCategory.Method));
}
}
......
......@@ -24,8 +24,8 @@ internal static ResultsViewExpansion CreateExpansion(DkmInspectionContext inspec
internal static EvalResultDataItem CreateResultsOnlyRow(
DkmInspectionContext inspectionContext,
string name,
DkmClrType declaredType,
DkmClrValue value,
EvalResultDataItem parent,
Formatter formatter)
{
string errorMessage;
......@@ -33,7 +33,7 @@ internal static ResultsViewExpansion CreateExpansion(DkmInspectionContext inspec
{
errorMessage = (string)value.HostObjectValue;
}
else if (value.HasExceptionThrown(parent))
else if (value.HasExceptionThrown(parent: null))
{
errorMessage = value.GetExceptionMessage(name, formatter);
}
......@@ -45,7 +45,7 @@ internal static ResultsViewExpansion CreateExpansion(DkmInspectionContext inspec
var expansion = CreateExpansion(inspectionContext, value, enumerableType, formatter);
if (expansion != null)
{
return expansion.CreateResultsViewRow(inspectionContext, name, parent, formatter);
return expansion.CreateResultsViewRow(inspectionContext, name, declaredType.GetLmrType(), value, includeResultsFormatSpecifier: true, formatter: formatter);
}
errorMessage = Resources.ResultsViewNoSystemCore;
}
......@@ -88,7 +88,7 @@ internal static ResultsViewExpansion CreateExpansion(DkmInspectionContext inspec
return null;
}
return expansion.CreateResultsViewRow(inspectionContext, name, declaredType.GetLmrType(), value, formatter);
return expansion.CreateResultsViewRow(inspectionContext, name, declaredType.GetLmrType(), value, includeResultsFormatSpecifier: false, formatter: formatter);
}
private static DkmClrType GetEnumerableType(DkmClrValue value)
......@@ -185,34 +185,23 @@ private ResultsViewExpansion(DkmClrValue proxyValue, Expansion proxyMembers)
{
if (InRange(startIndex, count, index))
{
rows.Add(CreateResultsViewRow(inspectionContext, Resources.ResultsView, parent, resultProvider.Formatter));
rows.Add(CreateResultsViewRow(inspectionContext, parent, resultProvider.Formatter));
}
index++;
}
private EvalResultDataItem CreateResultsViewRow(DkmInspectionContext inspectionContext, string name, EvalResultDataItem parent, Formatter formatter)
private EvalResultDataItem CreateResultsViewRow(DkmInspectionContext inspectionContext, EvalResultDataItem parent, Formatter formatter)
{
Debug.Assert(parent != null);
var proxyType = _proxyValue.Type.GetLmrType();
string fullName;
ReadOnlyCollection<string> formatSpecifiers;
if (parent == null)
{
Debug.Assert(name != null);
fullName = formatter.TrimAndGetFormatSpecifiers(name, out formatSpecifiers);
}
else
{
fullName = parent.ChildFullNamePrefix;
formatSpecifiers = parent.FormatSpecifiers;
}
var fullName = parent.ChildFullNamePrefix;
var childFullNamePrefix = (fullName == null) ?
null :
formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), fullName);
return new EvalResultDataItem(
ExpansionKind.ResultsView,
name,
Resources.ResultsView,
typeDeclaringMember: null,
declaredType: proxyType,
parent: null,
......@@ -222,18 +211,28 @@ private EvalResultDataItem CreateResultsViewRow(DkmInspectionContext inspectionC
childShouldParenthesize: false,
fullName: fullName,
childFullNamePrefixOpt: childFullNamePrefix,
formatSpecifiers: Formatter.AddFormatSpecifier(formatSpecifiers, "results"),
formatSpecifiers: Formatter.AddFormatSpecifier(parent.FormatSpecifiers, "results"),
category: DkmEvaluationResultCategory.Method,
flags: DkmEvaluationResultFlags.ReadOnly,
editableValue: null,
inspectionContext: inspectionContext);
}
private EvalResultDataItem CreateResultsViewRow(DkmInspectionContext inspectionContext, string name, Type declaredType, DkmClrValue value, Formatter formatter)
private EvalResultDataItem CreateResultsViewRow(
DkmInspectionContext inspectionContext,
string name,
Type declaredType,
DkmClrValue value,
bool includeResultsFormatSpecifier,
Formatter formatter)
{
var proxyType = _proxyValue.Type.GetLmrType();
ReadOnlyCollection<string> formatSpecifiers;
var fullName = formatter.TrimAndGetFormatSpecifiers(name, out formatSpecifiers);
if (includeResultsFormatSpecifier)
{
formatSpecifiers = Formatter.AddFormatSpecifier(formatSpecifiers, "results");
}
var childFullNamePrefix = formatter.GetObjectCreationExpression(formatter.GetTypeName(proxyType, escapeKeywordIdentifiers: true), fullName);
return new EvalResultDataItem(
ExpansionKind.Default,
......
......@@ -413,7 +413,7 @@ private void GetRootResultAndContinue(DkmClrValue value, WorkList workList, DkmC
else if ((inspectionContext.EvaluationFlags & DkmEvaluationFlags.ResultsOnly) != 0)
{
CreateEvaluationResultAndContinue(
ResultsViewExpansion.CreateResultsOnlyRow(inspectionContext, name, value, null, this.Formatter),
ResultsViewExpansion.CreateResultsOnlyRow(inspectionContext, name, declaredType, value, this.Formatter),
workList,
inspectionContext,
value.StackFrame,
......
......@@ -49,7 +49,6 @@ public class DkmClrValue : DkmDataContainer
public readonly DkmEvaluationResultFlags EvalFlags;
public readonly DkmClrValueFlags ValueFlags;
public readonly DkmClrType Type;
public DkmClrType DeclaredType { get { throw new NotImplementedException(); } }
public readonly DkmStackWalkFrame StackFrame;
public readonly DkmEvaluationResultCategory Category;
public readonly DkmEvaluationResultAccessType Access;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册