{
  "$type": "site.standard.document",
  "canonicalUrl": "https://johnnyreilly.com/posts/debugging-azure-functions-vs-code-mac-os",
  "description": "The VS Code debugging mechanism for Azure Functions on Mac OS frequently breaks. This post documents an approach to get it working.",
  "path": "/posts/debugging-azure-functions-vs-code-mac-os",
  "publishedAt": "2022-11-11T00:00:00.000Z",
  "site": "at://did:plc:yy3apqjlms24kso7ahn7lbmb/site.standard.publication/3mova7c4nho2b",
  "tags": [
    "azure functions",
    "vs code"
  ],
  "textContent": "VS Code's debugging mechanism for Azure Functions on Mac OS frequently breaks. This post documents an approach to get it working.\n\n\n\nThe problem\n\nI frequently use a Mac to develop Azure Functions. I use VS Code as my editor.\n\nDebugging is can be very useful when you're developing; getting to understand what the computer can see at runtime is a superpower. Regrettably with Azure Functions, I often find that the debugger fails to attach. When this happens, I can't actually debug my Azure Functions.\n\nThis is a known issue. In fact, this blog post is me sharing a workaround that I've needed again and again, but keep losing. Not my own work, the work of Bas Stottelaar. I share it as a public service announcement - and to remind myself how to do it! The original issue (and workaround) is here. Yay Bas!\n\nThere appears to be something wrong with the standard code signing of vsdbg and / or vsdbg-ui. The workaround is to sign the binaries yourself.\n\nThe workaround\n\nYou'll first need to generate a self signed certificate to be used for code signing. There's a good resource on Stack Overflow covering this. You should only ever need to do this once. You can then use the same certificate every time you apply the workaround.\n\nIn fact it's probably worth emphasising that you'll likely need to apply this workaround again and again. It's not a permanent fix. The workaround script that you need to run is:\n\nA thing to note about the above is the version in the path. You'll need to change that to match the version of the Cextension that you have installed. You can find the version in the VS Code extensions view:\n\nIn this case the version is 1.25.2; as is reflected in the path above.\n\nOnce the script has been run, I've found that restarting VS Code is a good idea. Regrettably the \"I cannot debug my Azure Functions\" issue is likely to reoccur in future. When it does, the workaround will need to be reapplied.\n\nIn the long term, I'd love to see some debugging improvements for Azure Functions. Until that time, we have this.",
  "title": "Debugging Azure Functions in VS Code on Mac OS"
}