vscode-csharp
vscode-csharp copied to clipboard
VS code debugging issue for azure powershell function - Omnisharp Json Rpc exception
Environment data
VS Code version: 1.68.0 C# Extension version: 1.25.0 Azure Core tools: v4 powershell version: 7
OmniSharp error

Steps to reproduce
- Create azure powershell function
- Put a breakpoint anywhere and hit F5
- See error
Expected behavior
Should be able to debug the function
Actual behavior
Exception of type Omnisharp.Extensions.JsonRpc.RpcErrorException was thrown
We have tried the scenarios like
- Uninstalling and Re-installing the C# version in VS Code Extensions
- changing the C# version in VS Code Extensions
- Restarting the VS Code
But getting the same exception for us too. Please give us a fix to this issue!
I am guessing the issue is that the C# extension is getting activated, but OmniSharp is unhappy that it can't find any C# code or projects in the workspace. But an OmniSharp log would probably be helpful if anyone from the OmniSharp team has the cycles to look at this...
@HariKrishnaRajoli-MT @gregg-miskelly please follow this thread https://github.com/Azure/azure-functions-core-tools/issues/3076
@lavibhatnagar I don't see an OmniSharp log in that issue either.
@gregg-miskelly @HariKrishnaRajoli-MT this issue has been logged as bug by azure function.
https://github.com/microsoft/vscode-azurefunctions/issues/3223
@gregg-miskelly a few users have reported this issue and provided some information in https://github.com/microsoft/vscode-azurefunctions/issues/3223. We haven't had much luck in our investigation and would appreciate any help you could provide! 😄
I landed here by searching for possible solutions to the main problem "Omnisharp Json Rpc exception" occuring in VS Code. I tried everything possibly written here but could not get the resolution. I spent complete day in hope to resolve this and finally could do it. Here are the steps that helped me:
-prerequisites:
-
PowerShell Extension for VS Code -> (or extension of your choice of language)
-
PowerShell Core 7 (Atleast I had this version installed on my machine)
-
There are two main files that are required to be checked after you have all prerequisites installed.
- launch.json
- tasks.json
-
configure launch.json { "name": "Attach to PowerShell Functions", "type": "PowerShell", "request": "attach", "customPipeName": "AzureFunctionsPSWorker", "runspaceId": 1, "processId": "${command:azureFunctions.pickProcess}", "preLaunchTask": "func start" //This should match with next tasks.json label }
-
configure tasks.json
{ "label": "func start", "type": "shell", "command": "func start", "problemMatcher": "$func-powershell-watch", "isBackground": true }
Hope it helps for someone facing the same problem.
@tanieee28 this works for me, modifying the tasks and launch json's.
sweet, that worked for me, thank you @tanieee28 !
I wish that the solution put forth by @tanieee28 worked for me, but unfortunately it did not. I seem to have to troubleshoot this issue with debugging every couple of weeks. Usually changing or adjusting something helps, but I have shot an entire day today just trying to run my code :( .
VSCODE: 1.81.1 C# ext: 2.0.376 PS ext: 2023.6.0 Az Func ext: 1.12.4 Az Func Core Tools: 4.0.5198 PowerShell: 7.3.6
Same error, although I only get it upon stopping the Azure Functions Core Tools. Very frustrating, and also this issue has been around a very long time.