I am having trouble debugging powershell function in vs code. Vs code: 1.68.0 Azure core tools: v4 Powershell : 7
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to PowerShell Functions",
"type": "PowerShell",
"request": "attach",
"customPipeName": "AzureFunctionsPSWorker",
"runspaceId": 1,
"preLaunchTask": "func: host start"
}
]
}
and function code:
run.ps1
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$name = $Request.Query.Name
if (-not $name) {
$name = $Request.Body.Name
}
$body = "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
if ($name) {
$body = "Hello, $name. This HTTP triggered function executed successfully."
}
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $body
})
this error (please see exception link) is occurring as soon as I hit f5. though I can see the host start task is starting but debugging is interrupted with this exception
can someone please help me in this issue?
CodePudding user response:
From our end, getting the same issue when debugging the Azure Functions PowerShell in VS Code:
I have tried with different scenarios, but debugging didn't work:
- Tried by changing the C# version in VS Code Extensions
- Restarting the VS Code, steps present in this GitHub Repo of Omnisharp-VSCode
I suggest raising the ticket as a bug in the GitHub Repo of Omnisharp-vscode for quick resolution.