question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restarting Kernel in VS Code no longer removes hold on the DLL files

See original GitHub issue

Describe 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:closed
  • Created 9 months ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
brettfocommented, Jan 24, 2023

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?

0reactions
brettfocommented, Jan 26, 2023

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode Jupyter cannot update kernels automatically
Quit and relaunch VS Code. It seems that VS Code is not that quick to update the interpreter list. Share.
Read more >
Cannot restart kernel after kernel dies #7167
Play could you file a new issues with sample code that causes the kernel to crash. This issue addresses restarting the kernel after...
Read more >
VS Code API | Visual Studio Code Extension API
A workspace is the collection of one or more folders that are opened in an editor window (instance). It is also possible to...
Read more >
The system has rebooted without cleanly shutting down first
Scenario 1: The computer restarts because of a Stop error, and Event ID 41 contains a Stop error (bug check) code. When a...
Read more >
[PC] How to Resolve Easy Anti-Cheat Errors
Error Code: 23 · Navigate to: C:\Program Files\Steam\steamapps\common\Warhammer Vermintide 2\EasyAntiCheat · Delete the 'Certificates' directory ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found