title | description | ms.date | ms.localizationpriority |
---|---|---|---|
Debug a function command with a non-shared runtime |
Learn how to debug function commands. |
08/18/2023 |
medium |
Important
If your add-in is configured to use a shared runtime, you debug the code behind the function command just as you would the code behind a task pane. See Debug Office Add-ins and note that a function command in an add-in with a shared runtime is not a special case as described in that article.
Note
This article assumes that you are familiar with function commands.
Function commands don't have a UI, so a debugger can't be attached to the process in which the function runs on desktop Office. (Outlook add-ins being developed on Windows are an exception to this. See Debug function commands in Outlook add-ins on Windows later in this article.) So function commands, in add-ins with a non-shared runtime, must be debugged in Office on the web where the function runs in the overall browser process. Use the following steps.
- Sideload the add-in in Office on the web, and then select the button or menu item that runs the function command. This is necessary to load the code file for the function command.
- Open the browser's developer tools. This is usually done by pressing F12. The debugger in the tools attaches to the browser process.
- Apply breakpoints to the code as needed for the function command.
- Rerun the function command. The process stops on your breakpoints.
Tip
For more detailed information, see Debug add-ins in Office on the web.
If your development computer is Windows, there's a way that you can debug a function command on Outlook desktop. See Debug function commands in Outlook add-ins.