dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 676 forks source link

Extension may keep .csproj files open preventing Visual Studio from running them #5737

Open The-MAZZTer opened 1 year ago

The-MAZZTer commented 1 year ago

Side note: I have no CSharp: Report an issue (not present in preview?)

Environment data

dotnet --info output:

.NET SDK: Version: 7.0.302 Commit: 990cf98a27

Runtime Environment: OS Name: Windows OS Version: 10.0.19045 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.302\

Host: Version: 7.0.5 Architecture: x64 Commit: 8042d61b17

.NET SDKs installed: 7.0.302 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

VS Code version:

[Window Title] Visual Studio Code

[Main Instruction] Version: 1.78.2 (user setup) Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435 Date: 2023-05-10T14:39:26.248Z (4 wks ago) Electron: 22.5.2 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.19045 Sandboxed: Yes

C# Extension version:

C# v2.0.206 Pre-Release

OmniSharp log

N/A

Steps to reproduce

Not consistent. I was not actively using the extension but it was running in the background with the solution open.

Expected behavior

Visual Studio should be able to continue using the same solution/project files without interference even if VS Code has them open.

Actual behavior

Occasionally Visual Studio will display an error indicating a CSPROJ file is locked. This may happen when using the "Start" button to run a project.

Additional context

Upon closing the VS Code window for the project the file was no longer locked. Reopening the window could not reproduce the issue. Possibly the extension is leaking a file handle somewhere?

dibarbet commented 1 year ago

@tmeschter @lifengl is this expected? Is this a supported scenario?

The-MAZZTer commented 1 year ago

I know you didn't direct that at me, but let me cover my use case.

I use VSCode to edit non-C# files in projects (for example, Angular frontend files) and use VS for the C# stuff. Simply opening the folder with the solution file in VSCode will cause the new C# extension to load in the solution and project files. So I think it should be supported since it is not really desired (at least by me) to disable the C# extension selectively to prevent potential issues like this.