Chrome debugger / breakpoint stops on wrong line

It was from version 0.47 that my breakpoints in the tool for creating chrome technically stopped at the right line, but they were displayed differently in the source code panel. there would always be 1 or 2 line shifts between the actual breakpoint and the highlighted blue line. which makes it very difficult to debug as it never showed correctly, has anyone heard of a solution?

if(true){
  this.anyfunction();
  debugger;
  var toto = 10;
  toto ++;
}

In this example, the first blue line selected in the source code should be toto ++, while toto will be undefined if you add a clock to this, so I assume that the breakpoint is correctly pressed, but there is a problem with the display ...

+4
source share
2 answers

Is your expression spread across multiple lines? For instance:

var x = 1 +
        2 +
        3 +
        4 +
        5;

This is known to cause erratic behavior. When I set a breakpoint on line 1 and then run the script, DevTools stops on line 4.

Solution: Set a breakpoint on the line above the expression.

0
source

I ran into the same problem, it works fine after changing the settings of the validation tools in Chrome ..

  1. Click the three-dot icon in the upper right corner of the scan tool and select " Settings . " (or) Press F1.
  2. " JavaScript" " ".
  3. ...
0

Source: https://habr.com/ru/post/1663336/


All Articles