0

My vs code debugger is not recognizing any breakpoints, nor is it logging any console.log messages. The web inspector is working, but the vs code debugger is not.

I've tried editing launch.json and tasks.json. I am using the Office Add-ins Development Kit to create a simple add-in to get this setup. I have installed the Microsoft Edge Tools for VS Code as well.

this is my launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Excel Desktop (Edge Chromium)",
      "type": "msedge",
      "request": "attach",
      "port": 9222, // Default debugging port for Edge
      "timeout": 600000,
      "webRoot": "${workspaceFolder}",
      "preLaunchTask": "Debug: Excel Desktop",
      "postDebugTask": "Stop Debug",
      "sourceMaps": true,
      "trace": true,
      "sourceMapPathOverrides": {
        "webpack:///./*": "${workspaceFolder}/*"
      }
    },
    {
      "name": "Excel Desktop (Edge Legacy)",
      "type": "chrome",
      "request": "attach",
      "url": "https://localhost:3000/taskpane.html?_host_Info=Excel$Mac$16.01$en-US$$$$0",
      "port": 9222, // Default debugging port for Chrome
      "timeout": 600000,
      "webRoot": "${workspaceFolder}",
      "preLaunchTask": "Debug: Excel Desktop",
      "postDebugTask": "Stop Debug",
      "sourceMaps": true,
      "trace": true,
      "sourceMapPathOverrides": {
        "webpack:///./*": "${workspaceFolder}/*"
      }
    }
  ]
}

below is what I am trying to debug. It is from the example provided by Microsoft when learning office add-ins.

/*
 * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
 * See LICENSE in the project root for license information.
 */

/* global console, document, Excel, Office */

Office.onReady((info) => {
  if (info.host === Office.HostType.Excel) {
    document.getElementById("sideload-msg").style.display = "none";
    document.getElementById("app-body").style.display = "flex";
    document.getElementById("run").onclick = run;
  }
});

export async function run() {
  try {
    await Excel.run(async (context) => {
      /**
       * Insert your Excel code here
       */
      const range = context.workbook.getSelectedRange();

      // Read the range address
      range.load("address");

      // Update the fill color
      range.format.fill.color = "yellow";
      console.log("hi");

      await context.sync();
      console.log(`The range address was ${range.address}.`);
    });
  } catch (error) {
    console.error(error);
  }
}
7
  • Can you share a minimal reproducible example of code you are trying to debug? (Please add it to your question using edit) Commented Nov 30, 2024 at 16:19
  • "...provided by Microsoft when learning office add-ins." Why do you not (also) share a link to that provider? Commented Nov 30, 2024 at 17:01
  • I think the info you are searching for is here: Debug add-ins using developer tools in Microsoft Edge Commented Nov 30, 2024 at 17:03
  • Thank you for your help with this. I'm not sure how to include the link to the provider. I used the office add-in development kit extension in vs code to create this sample. Commented Nov 30, 2024 at 17:47
  • when I look at the personality menu for the add-in that runs (but won't debug), it says this. Source: Store Runtime: Safari WebKit Version: 3.0.0.0. Could this be a reason why I cannot debug? Commented Dec 1, 2024 at 14:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.