Reputation: 3419
I first set a breakpoint on the let line, the if statement line, and the await line.
Assuming I break on the let line and then press run to next breakpoint, the code does hit the next breakpoint.
However, if I'm on the let line, I can press step over and go to the const test
line, hit step over again, and it jumps over the if statement and goes to the const test2
line. Pushing run does not lead to the await line and pushing step over or into after reaching test2 results in me going into other code.
As a former Visual Studio user this is really strange behavior to me. I don't know if it's a TypeScript peculiarity or something to do with TypeScript/JavaScript and the async/await construct.
I've rebuilt several times just to verify that my code matches what's running on the server.
I thought that await line should get hit, then it should suspend the rest of the function.
public async requestList() {
let res = this.cache.get(serializedParam);
const test = 'test';
if (!res) {
const test2 = 'test2';
const _res = await Function(param);
}
Upvotes: 0
Views: 608
Reputation: 93868
The issue looks similar to WEB-39041, please follow it for updates. It only occurs when using sourcemaps, stepping works fine when debugging pure Javascript
Upvotes: 1
Reputation: 21681
Try this:
Declare the function as 'async' in order to use await. The function needs tobe async.
async requestList() {
let res = this.cache.get(serializedParam);
const test = 'test';
if (!res) {
const test2 = 'test2';
const _res = await Function(param);
}
}
async Function(param){
}
Upvotes: 0