Apps Script debugger won't let me look at values in objects (including arrays and block scopes)

删除回忆录丶 提交于 2020-08-15 05:41:31

问题


I'm trying to debug an Apps Script project, and for the past 2–3 days, the debugger hasn't let me look at variables defined at the scope level.

For example, I was trying to debug this code.

/**
 * Deletes all rows in a sheet, excluding header rows. Just calling sheet.deleteRows() 
 * for a massive range of rows will throw out an error.
 * @private
 * 
 * @param {Sheet} sheet 
 * @param {number = 0} numHeaderRows 
 * @param {number = 500} deletionSize - The number of rows to delete at a time
 */
function deleteAllNonHeaderRows_(sheet, numHeaderRows = 0, deletionSize = 500) {
  const startingNumberOfRows = sheet.getMaxRows();
  for (let numRows = startingNumberOfRows; numRows > numHeaderRows; numRows -= deletionSize) {
    if (numRows < deletionSize) {
      const deletionArgs = [numHeaderRows + 1, sheet.getLastRow() - numHeaderRows]
      sheet.deleteRows(...deletionArgs);
    } else {
      sheet.deleteRows(numRows - deletionSize, deletionSize);
    }
  }
}

It normally would have been a quick process, but since I couldn't look at the value of the arguments I was trying to pass into sheet.deleteRows(), it took me a moment to tell that I should have used sheet.getMaxRows() instead of sheet.getLastRow(). Using the debugger brings up a menu that lists all the scopes, but trying to expand the block scopes doesn't do anything. After some tinkering, I found that this problem extends to everything implemented as an object, so arrays are included, too. Expanding local scopes works, but if any kind of object is in there, I can't expand it.

Image linked because this is my first post, and I can't embed yet

I'm not sure what could be causing this problem. I was coding in Edge, but switching to Chrome didn't change anything (likely because they're both Chromium-based). I've also tried disabling all my ad blockers and privacy protectors. Looking up issues other people have had didn't turn up any recent posts, either. Is there anything that can be done? I also keep occasionally getting error messages saying something like "Could not connect to server". But the scripts themselves run fine, whether they're run in the container-bound file or the editor itself.


回答1:


V8 debugging is currently experiencing bugs

(as of July 23, 2020)

Using the debugger results in non-responsive UI (reports vary), server responses of 409, breakpoints hang execution. Star the issue linked to below if you are experiencing similar behavior.

Link to Issue in Google's IssueTracker: "Debug mode not responsive in V8"



来源:https://stackoverflow.com/questions/63058299/apps-script-debugger-wont-let-me-look-at-values-in-objects-including-arrays-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!