microsoft / vscode-azurefunctions

Azure Functions extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions
MIT License
291 stars 132 forks source link

launch.json configuration needs `targetArchitecture` on arm64 macOS/Windows #3005

Open gregg-miskelly opened 2 years ago

gregg-miskelly commented 2 years ago

Hello, I work on the debugger that ships with the C# extension.

On arm64 macOS, the C# extension will default to debugging using the debugger that matches the machine architecture as long as an arm64 .NET runtime is installed. At least in the configuration used by https://github.com/OmniSharp/omnisharp-vscode/issues/4900, Azure Functions will run in an x64 process, causing debugging to fail.

If Azure Functions always uses an x64 process, the following should be added to the template:

"targetArchitecture": "x86_64"

If the correct architecture is more complicated then that, hopefully a command can be used to query the Azure functions extension for the right architecture.

Note that the debugger will currently ignore targetArchitecture in scenarios where the debugger only installs one architecture. Which is currently the case for all platforms except for arm64 macOS, though it is possible that someday we could support this on Windows.

ejizba commented 2 years ago

At the moment, the func cli only supports x64, but that will likely change going forward (https://github.com/Azure/azure-functions-core-tools/issues/2834)

gregg-miskelly commented 2 years ago

In that case I would probably suggest something like:

    "configurations": [
    {
      "name": "Attach to .NET Functions",
      "type": "coreclr",
      "request": "attach",
      "processId": "${command:azureFunctions.pickProcess}",
      "targetArchitecture": "${command:azureFunctions.targetArchitecture}"
     }
  ]
hajekj commented 1 year ago

I think that when we merge this PR (https://github.com/OmniSharp/omnisharp-vscode/pull/5646) there should be no blocker to add this, and I will be happy to submit a PR. This will also enable a seamless workflow on both Mac and Windows ARM64 devices.