Skip to content

Commit

Permalink
Merge pull request #2 from KevinH-MS/future
Browse files Browse the repository at this point in the history
Remove extraneous call to DkmWorkList.Execute...
  • Loading branch information
tannergooding committed Dec 31, 2015
2 parents 4b2b59d + 0dd7054 commit 4d0a505
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,8 @@ public class Picard { }
var assembly = GetAssembly(source);
var picard = assembly.GetType("Picard");
var jeanLuc = picard.Instantiate();
var result = FormatResult("says", CreateDkmClrValue(jeanLuc), declaredType: new BadType(picard));
Verify(result,
EvalFailedResult("says", BadType.Exception.Message, null, null, DkmEvaluationResultFlags.None));
var result = FormatAsyncResult("says", "says", CreateDkmClrValue(jeanLuc), declaredType: new BadType(picard));
Assert.Equal(BadType.Exception, result.Exception);
}

private class BadType : DkmClrType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,6 @@ private static void EvaluateDebuggerDisplayStringAndContinue(
{
onException(e);
}

workList.Execute();
};
if (str == null)
{
Expand Down Expand Up @@ -1003,7 +1001,7 @@ internal void ContinueWith(CompletionRoutine completionRoutine)
}
}

internal void Execute()
private void Execute()
{
Debug.Assert(_state != State.Executing);
_state = State.Executing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public struct DkmEvaluationAsyncResult
private readonly DkmEvaluationResult _result;

public DkmEvaluationAsyncResult(DkmEvaluationResult Result)
: this()
{
if (Result == null)
{
Expand All @@ -26,9 +27,11 @@ public DkmEvaluationAsyncResult(DkmEvaluationResult Result)

public DkmEvaluationResult Result { get { return _result; } }

internal Exception Exception { get; set; }

public static DkmEvaluationAsyncResult CreateErrorResult(Exception exception)
{
throw new NotImplementedException();
return new DkmEvaluationAsyncResult() { Exception = exception };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,18 @@ internal DkmEvaluationResult FormatResult(string name, DkmClrValue value, DkmClr

internal DkmEvaluationResult FormatResult(string name, string fullName, DkmClrValue value, DkmClrType declaredType = null, bool[] declaredTypeInfo = null, DkmInspectionContext inspectionContext = null)
{
DkmEvaluationResult evaluationResult = null;
var asyncResult = FormatAsyncResult(name, fullName, value, declaredType, declaredTypeInfo, inspectionContext);
var exception = asyncResult.Exception;
if (exception != null)
{
ExceptionDispatchInfo.Capture(exception).Throw();
}
return asyncResult.Result;
}

internal DkmEvaluationAsyncResult FormatAsyncResult(string name, string fullName, DkmClrValue value, DkmClrType declaredType = null, bool[] declaredTypeInfo = null, DkmInspectionContext inspectionContext = null)
{
DkmEvaluationAsyncResult asyncResult = default(DkmEvaluationAsyncResult);
var workList = new DkmWorkList();
value.GetResult(
workList,
Expand All @@ -174,9 +185,9 @@ internal DkmEvaluationResult FormatResult(string name, string fullName, DkmClrVa
FormatSpecifiers: Formatter.NoFormatSpecifiers,
ResultName: name,
ResultFullName: fullName,
CompletionRoutine: asyncResult => evaluationResult = asyncResult.Result);
CompletionRoutine: r => asyncResult = r);
workList.Execute();
return evaluationResult;
return asyncResult;
}

internal DkmEvaluationResult[] GetChildren(DkmEvaluationResult evalResult, DkmInspectionContext inspectionContext = null)
Expand Down

0 comments on commit 4d0a505

Please sign in to comment.