Restarting Kernel in VS Code no longer removes hold on the DLL files
See original GitHub issueDescribe the bug
I have a workflow where I use Visual Studio for writing code, and VS Code for writing C# Interactive code. In the past, I would run some code snippet in Polyglot Notebook, click “Restart” (kernel), and then make changes in Visual Studio and Rebuild the projects. I needed to click “Restart” because otherwise Visual Studio is unable to move/modify the dll files that Polyglot Notebooks is holding onto.
However, recently the new version of the Polyglot Notebooks extension forces me to install .NET 7 SDK. After doing so, my workflow no longer works. More specifically, clicking “Restart” now no longer enables Visual Studio to rebuild my projects. Restarting VS code works but isn’t an ideal workflow for me.
I have now downgraded to version v1.0.3557011 (randomly chosen) and uninstalled .NET 7 SDK to re-enable my workflow.
Please complete the following:
Which version of .NET Interactive are you using? (In a notebook, run the #!about
magic command. ):
- OS: Windows 11
- Frontend: Visual Studio Code with Polyglot Notebooks
Working version:
Version: 1.0.355701+da7df87cf78413155f55bbfe16c0c2a82c79162e
Library version: 1.0.0-beta.22557.1+da7df87cf78413155f55bbfe16c0c2a82c79162e
Build date: 2022-12-08T19:11:38.1859027Z
Breaking version:
Version: 1.0.360602+9bf026dabac44a6256a65168fa93dcb7e2edcca4
Library version: 1.0.0-beta.22606.2+9bf026dabac44a6256a65168fa93dcb7e2edcca4
Build date: 2022-12-08T18:49:35.7173095Z
Screenshots
Here’s the log file for failed attempt to rebuild solution
4>------ Rebuild All started: Project: GatewayUnitTests, Configuration: Debug Any CPU ------
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5599,5): warning MSB3061: Unable to delete file "C:\[Redacted]\Notebook\bin\Debug\net6.0\Notebook.dll". Access to the path 'C:\[Redacted]\Notebook\bin\Debug\net6.0\Notebook.dll' is denied.
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5599,5): warning MSB3061: Unable to delete file "C:\[Redacted]\Notebook\bin\Debug\net6.0\AnalyticalBalance.dll". Access to the path 'C:\[Redacted]\Notebook\bin\Debug\net6.0\AnalyticalBalance.dll' is denied.
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5599,5): warning MSB3061: Unable to delete file "C:\[Redacted]\Notebook\bin\Debug\net6.0\Gateway.dll". Access to the path 'C:\[Redacted]\Notebook\bin\Debug\net6.0\Gateway.dll' is denied.
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 2 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 2 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 3 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 3 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 4 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 4 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 6 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 6 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 7 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 7 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 8 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 8 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 9 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 9 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Beginning retry 10 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): warning MSB3026: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Beginning retry 10 in 1000ms. The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): error MSB3027: Could not copy "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". Exceeded retry count of 10. Failed. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): error MSB3027: Could not copy "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". Exceeded retry count of 10. Failed. The file is locked by: ".NET Host (10832)"
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): error MSB3021: Unable to copy file "C:\[Redacted]\Gateway\bin\Debug\net6.0\Gateway.dll" to "bin\Debug\net6.0\Gateway.dll". The process cannot access the file 'bin\Debug\net6.0\Gateway.dll' because it is being used by another process.
3>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4809,5): error MSB3021: Unable to copy file "C:\[Redacted]\AnalyticalBalance\bin\Debug\net6.0\AnalyticalBalance.dll" to "bin\Debug\net6.0\AnalyticalBalance.dll". The process cannot access the file 'bin\Debug\net6.0\AnalyticalBalance.dll' because it is being used by another process.
3>Done building project "Notebook.csproj" -- FAILED.
4>GatewayUnitTests -> C:\[Redacted]\GatewayUnitTests\bin\Debug\net6.0\GatewayUnitTests.dll
========== Rebuild All: 3 succeeded, 1 failed, 0 skipped ==========
Issue Analytics
- State:
- Created 9 months ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top GitHub Comments
We just pushed (less than an hour ago) an update to VS Code - Insiders that may have a fix for this, can you try it again?
@pgrit @kmccalvin Glad to hear it’s working. As for the comment/un-comment feature, yes, that’s also something that we recently fixed in the insiders build in #2592.
All of these fixes will make it to the stable build of VS Code when the next version ships out, usually in the first week or so of the next month.