Debugger Stepping Out of Asynchronous Method Continuation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Debugging asynchronous processes in programming languages like Visual F#, Visual C#, and Visual Basic is challenging due to the asynchronous methods returning to continuations that are not on the call stack, making it difficult for debuggers to naturally continue debugging, as they require manual breakpoint setting and can lead to burdensome processes.
Innovation Solution
Implementing a method where a debugger correlates a debugging indicator with an asynchronous function call, allowing it to automatically step out of the asynchronous process and continue execution at the corresponding continuation by setting a flag or using a task state machine object, enabling seamless debugging without manual breakpoint setup.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If a debugger uses traditional call stack navigation for asynchronous methods, then the debugger can naturally step through synchronous code, but it cannot naturally continue debugging at the continuation when the asynchronous method completes
Solution Approach 1:
The system performs preliminary action by capturing the continuation location and setting a breakpoint before the asynchronous method actually completes. The debugger records the continuation frame information when the await point is reached, so that when the asynchronous method finishes, the debugger already has the necessary information to automatically navigate to and resume debugging at the correct continuation location without requiring manual intervention or complex real-time call stack management.
2Reliability
If developers manually set breakpoints to debug asynchronous continuations, then they can investigate the continuation state, but the debugging process becomes burdensome and time-consuming
Solution Approach 1:
The system implements self-service by automatically managing the debugging process for asynchronous continuations. When an asynchronous method completes, the debugger automatically identifies the continuation location, sets the appropriate breakpoint, and resumes execution at the correct frame without requiring the developer to manually calculate or set breakpoints. This automation eliminates the burdensome manual process while maintaining reliable continuation debugging capability.
3Difficulty of detecting and measuring
If the debugger follows the call stack for asynchronous methods, then it can track active method calls, but it cannot locate the continuation code which is not on the call stack
Solution Approach 1:
The system uses an intermediary mechanism - the continuation frame object - to bridge the gap between the asynchronous method completion and the continuation code. When the asynchronous method completes, the continuation frame acts as a mediator that contains the necessary execution context and location information. The debugger accesses this intermediary object to automatically navigate to the continuation, solving the problem of detecting continuation locations without losing frame information.
Data Source
AI summary
Stepping out of an asynchronous process. A method includes, as part of a computer program execution, at a caller, making an asynchronous function call from the caller to a callee. Associated with the asynchronous function call a continuation waits for the completion of the callee with respect to the asynchronous function call. The method further includes correlating a debugging indicator to the callee indicating that a user wishes to step out of the caller when the callee returns. An indication of completion of the callee with respect to the asynchronous function call and that a user wishes to step from the callee to the continuation is received. The debugging indicator is referenced and based on the debugging indicator execution at entry into the continuation is stopped.


