Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
making sure bp.actual location is not null/undefined before trying to access its line number #381
Chrome core has a known issue where occasionally it returns an empty locations array: ChromeDevTools/devtools-protocol#103
When this happens, actual location is undefined and throws an error, causing the browser to hang without loading the page. Stack trace from logs:
This change is just to make sure that the browser doesn't hang
I am leaning more towards bug, but I'm not certain. From the issue it seemed as though the locations array shouldn't be empty. Also, when I was testing with some of the breakpoint locations where we are getting back empty location arrays, if I run the project without debugging through the editor and just use F12 in Chrome, the same breakpoints successfully bind to a location and pause at those locations.
Also, if I debug with Edge, we don't have this issue.
I'm slightly surprised that not all the elements of commitedBps have a valid location. I think this is a valid way to avoid the crash.
The other option we could consider is to modify: https://github.com/Microsoft/vscode-chrome-debug-core/blob/master/src/chrome/chromeDebugAdapter.ts#L1667 so that we don't consider the breakpoints commited if it doesn't have a valid location. I'm not sure what the consequences of that change would be, so I think that the current approach is okay.