Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate DkmEvaluationResults asynchronously #986

Merged
merged 6 commits into from
Mar 4, 2015
Merged

Conversation

cston
Copy link
Member

@cston cston commented Mar 3, 2015

Generate subsequent DkmEvaluationResults asynchronously rather than in completion from previous DkmEvaluationResults to avoid stack overflow when many items are requested and evaluation is not already asynchronous (when EvaluateDebuggerDisplayString is not used).

@cston
Copy link
Member Author

cston commented Mar 3, 2015

@KevinH-MS, @amcasey, @pnelsonmsft

{
internal readonly DkmWorkList InnerWorkList;
private readonly CompletionRoutine<Exception> _onException;
private WorkListCompletionRoutine _completionRoutine;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, there are three kinds of completion routines floating around, WorkListCompletionRoutine, CompletionRoutine, and DkmCompletionRoutine. However, we seem to call locals of all three types "completionRoutine". I think the code would be much easier to follow if we gave them distinct names.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed WorkListCompletionRoutine.

@amcasey
Copy link
Member

amcasey commented Mar 3, 2015

Consider splitting CompletionRoutine into

internal delegate void ExceptionCompletionRoutine(Exception exception);
internal delegate void SuccessCompletionRoutine(DkmEvaluationResult result);

() => ContinueWithExceptionHandling(
var wl = new WorkList(workList, e => completionRoutine(DkmEvaluationEnumAsyncResult.CreateErrorResult(e)));
GetEvaluationResultsAndContinue(rows, results, 0, numRows, wl, inspectionContext, value.StackFrame,
() => wl.ContinueWith(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we could call wl.ContinueWith outside the lambda (e.g. immediately after construction).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lambda passed to wl.ContinueWith must be the last continuation, after any added while executing GetEvaluationResultsAndContinue.

@@ -35,6 +35,11 @@ internal void AddWork(Action item)
_workList.Enqueue(item);
}

internal int Length
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this isn't part of the real type, can we add a doc comment?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using => body for trivial properties.

@KevinH-MS
Copy link
Contributor

LGTM

cston added a commit that referenced this pull request Mar 4, 2015
Generate DkmEvaluationResults asynchronously

Generate subsequent DkmEvaluationResults asynchronously rather than in the completion from previous DkmEvaluationResults to avoid stack overflow when many items are requested and evaluation is not already asynchronous (when EvaluateDebuggerDisplayString is not used).
@cston cston merged commit d09927b into dotnet:master Mar 4, 2015
@cston cston deleted the Async branch March 4, 2015 02:08
() =>
{
results[index] = result;
if (index < numRows - 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "index < numRows"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numRows - 1 since we're deciding whether to evaluate row index + 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we get the same result if we changed it to "index < numRows" and removed the "else..."? That is, would the outer if catch it and call the completion routine when we call GetEvaluationResultsAndContinue with "index + 1"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, could we remove the if/else from the lambda entirely and just call GetEvaluationResultsAndContinue (relying on the outer if to call the completionRoutine)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants