Investigating microsoft/vscode-js-debug#161, the call flow is:
- The debug adapter receives a log message
- It stores variables and tells the client that output was received, passing a variablesReference
- The program terminates
- The variables are never resolved / output is not shown because the session ended before the client requests the variables
The was not a problem in the previous JS adapter with the given example script simply because there's short circuit logic in the event that we only log a string--but this obviously isn't something that will work for all scenarios.
The clear way I see to solve this would be to allow the debug adapter to eagerly provide the variable reference in the output; I don't think there's really another good way to solve the race above short of holding the session open for some arbitrary period of time expecting that the client might request variables.
Trace of one scenario where this happened, which you can view using the tool.
This would also help solve microsoft/vscode-js-debug#122.
Investigating microsoft/vscode-js-debug#161, the call flow is:
The was not a problem in the previous JS adapter with the given example script simply because there's short circuit logic in the event that we only log a string--but this obviously isn't something that will work for all scenarios.
The clear way I see to solve this would be to allow the debug adapter to eagerly provide the variable reference in the output; I don't think there's really another good way to solve the race above short of holding the session open for some arbitrary period of time expecting that the client might request variables.
Trace of one scenario where this happened, which you can view using the tool.
This would also help solve microsoft/vscode-js-debug#122.