-
Notifications
You must be signed in to change notification settings - Fork 142
Description
Issue Summary
When working with Azure Functions in .NET (isolated process) in Visual Studio Code, using the "Attach to .NET Functions" debugger configuration, the "Restart" button leaves the original function host process or debugger in an inconsistent state.
This causes two major issues:
- The ports used by the function (e.g., 7071 or 7100) are still occupied.
- The DLL files are locked by zombie
.NET Host
processes, leading to MSBuild errors during rebuild.
Steps to Reproduce
- Run an Azure Function (isolated .NET 8) locally in VS Code.
- Attach to the function using this
launch.json
config:
{
"name": "Attach to .NET Functions",
"type": "coreclr",
"request": "attach",
"processId": "${command:azureFunctions.pickProcess}"
}
Click the "Restart" button in the debugger.
VS Code throws:
No process with the specified ID is currently running..
After restart:
The port (7071 or 7100) is still in use.
Rebuilding the project fails with:
MSB3027: Could not copy "...az.dll"
The file is locked by: ".NET Host (PID 10020)"
Workaround
Kill the zombie process manually:
Or kill all dotnet processes:
taskkill /IM dotnet.exe /F
Or restart VS Code completely.
Expected Behavior
Clicking "Restart" should properly detach and re-attach the debugger, cleaning up the old process and freeing any ports or file locks.
It should not leave .NET Host processes hanging or locked on the function DLL.
Environment
OS: Windows 11
VS Code: 1.98.2
Azure Functions Core Tools: 4.0.6821
Azure Functions Extension: 1.16.3
.NET SDK: 8.0.101
Runtime: .NET Isolated
Func port: 7071 / 7100 (default)