1

Beginner in Office add-ins and VS code here...

I followed the steps from this MS tutorial on creating an Excel custom functions add-in. Because I want to debug it using VS code, I had to create an Excel Custom Functions Add-in project option in the Yeoman generator, with TypeScript selected as the script type (according to MS).

The add-in works fine, but the related debugging tutorial from MS doesn't seem to work. Any breakpoint added appears as unbound, plus there's a "read source map" error, which might be related (see screenshot).

Any ideas how can I make this working?

Thank you for your time,

Adrian

Edit: this is the content of launch.json, I didn't change what Yeoman generated.

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Excel Desktop (Custom Functions)",
      "type": "node",
      "request": "attach",
      "port": 9229,
      "timeout": 600000,
      "preLaunchTask": "Debug: Excel Desktop",
      "postDebugTask": "Stop Debug",
      "resolveSourceMapLocations": null
    },
    {
      "name": "Excel Desktop (Edge Chromium)",
      "type": "pwa-msedge",
      "request": "attach",
      "useWebView": true,
      "port": 9229,
      "timeout": 600000,
      "webRoot": "${workspaceRoot}",
      "preLaunchTask": "Debug: Excel Desktop",
      "postDebugTask": "Stop Debug"
    },
    {
      "name": "Excel Desktop (Edge Legacy)",
      "type": "office-addin",
      "request": "attach",
      "url": "https://localhost:3000/taskpane.html?_host_Info=Excel$Win32$16.01$en-US$$$$0",
      "port": 9222,
      "timeout": 600000,
      "webRoot": "${workspaceRoot}",
      "preLaunchTask": "Debug: Excel Desktop",
      "postDebugTask": "Stop Debug"
    },
    {
      "name": "Office Online (Chrome)",
      "type": "chrome",
      "request": "launch",
      // To debug your Add-in:
      // 1. When prompted, enter the url (share link) to an Office Online document.
      // 2. Sideload your Add-in. https://learn.microsoft.com/en-us/office/dev/add-ins/testing/sideload-office-add-ins-for-testing
      "url": "${input:officeOnlineDocumentUrl}",
      "webRoot": "${workspaceFolder}",
      "preLaunchTask": "Debug: Web"
    },
    {
      "name": "Office Online (Edge Chromium)",
      "type": "pwa-msedge",
      "request": "launch",
      "port": 9222,
      // To debug your Add-in:
      // 1. When prompted, enter the url (share link) to an Office Online document.
      // 2. Sideload your Add-in. https://learn.microsoft.com/en-us/office/dev/add-ins/testing/sideload-office-add-ins-for-testing
      "url": "${input:officeOnlineDocumentUrl}",
      "webRoot": "${workspaceFolder}",
      "preLaunchTask": "Debug: Web"
    }
  ],
  "inputs": [
    {
      "id": "officeOnlineDocumentUrl",
      "type": "promptString",
      "description": "Please enter the url for the Office Online document."
    }
  ]
}

error

user2285985
  • 79
  • 1
  • 6

1 Answers1

0

You can use VS Code to debug custom functions that don't use a shared runtime in Office Excel on the desktop. So, make sure that you don't use the shared runtime in the add-in.

To use VS Code with Microsoft Edge, you must install the Microsoft Edge DevTools extension for Visual Studio Code.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Yes, I'm aware of that, but according to the requirements mentioned in the above custom functions debugging tutorial: "A custom function that doesn't use a shared runtime is an Excel Custom Functions Add-in project created with the Yeoman generator for Office Add-ins.", which is exactly the project I created.. So I assume my project doesn't use a shared runtime. – user2285985 Jul 09 '22 at 13:36
  • What is your option from the launch.json file? – Eugene Astafiev Jul 10 '22 at 12:59
  • The first one: Excel Desktop (Custom Functions) – user2285985 Jul 10 '22 at 16:08
  • See [Debugger spams "Could not read sourcemaps" messages](https://github.com/microsoft/vscode/issues/102042) – Eugene Astafiev Jul 10 '22 at 16:24