Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] On Windows, file handles are opened with no FILE_SHARE_* mode, preventing other software (e.g. extensions) from opening those files #82

Closed
BinToss opened this issue Nov 25, 2023 · 5 comments · Fixed by #83

Comments

@BinToss
Copy link

BinToss commented Nov 25, 2023

I've been frequently noticing dotnet build and similar operations complaining about "access denied" and "The process cannot access the file .../obj/project.assets.json because it is being used by another process."

Searching for handles with System Informer results in the relevant files only being opened by the dotnet.exe process hosting this extension.
image
image
image

@tintoy
Copy link
Owner

tintoy commented Nov 25, 2023

That’s odd; I thought we didn’t keep that file open for any real length of time but I’ll see if we can explicitly specify the sharing flags anyway.

Thanks for reporting!

@tintoy
Copy link
Owner

tintoy commented Nov 26, 2023

Oops! As it turns out, we completely forget to close that file handle until the stream gets garbage-collected:

rootNode = JsonNode.Parse(projectAssetsFile.OpenRead());

I’ll sort that out sometime today 🙂

tintoy referenced this issue Nov 27, 2023
- Ensure file stream is closed as soon as the contents have been read
- Use FileShare.Read to enable simultaneous read-access by other processes

tintoy/msbuild-project-tools-vscode#139
@tintoy
Copy link
Owner

tintoy commented Nov 27, 2023

Transferring this issue to the language server repository.

@tintoy tintoy transferred this issue from tintoy/msbuild-project-tools-vscode Nov 27, 2023
@tintoy
Copy link
Owner

tintoy commented Nov 27, 2023

We’ll get a new package published today or tomorrow 🙂

@tintoy
Copy link
Owner

tintoy commented Nov 28, 2023

Published v0.5.3 to the VS extension gallery (it may take a couple of minutes to be come visible) 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants