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
Please don't lock the tsconfig.json file #1032
Comments
@claycephas we don't do anything special with the tsconfig.json file and I wasn't able to reproduce this. Can you please use the handle tool from sysinternals (https://technet.microsoft.com/en-us/sysinternals/bb896655.aspx) to see who is locking the file in your case? |
I have the same isue. I dont explicitly open the file but I have a task that modifies it for me. However even if that task is killed I still have to close Visual studio code to unlock the file. |
+1 |
It happened again... code.exe is locking the file according to handle |
@Clivar do you have any additional steps. I tried various scenarios (having tsconfig.json open, changing it, ....) but I couldn't make code holding a handle to it. I suspect that the tsserver is holding the handle but before moving it to them I want to make sure that this is the case. When it happens the next time can you provide the command line of the code.exe process holding the lock. That would help ti understand which part of the code is the culprit here since code is multi process and one VSCode instance start ~6 code.exe processes. |
fwiw, try installing gitex and see if that has to do with anything. The last time I remember it happening was when I checkout/merge branches. Intellisense went crazy and I finally tracked it down to the tsconfig.json being missing. Happened a few more times with the tsconfig.json either being locked or gone all together. |
@tonyeung Exactly, I have it when pulling or merging with git. File went missing or was empty sometimes aswell. Happens quite a bit. Closing and reopening code has always fixed the access denied issue so far |
@Clivar how do you interact with git (git bash or gitex or sourcetree)? |
git bash. I do however commit from inside vs code |
@Clivar thanks. So to clarify, you commit within vscode, but do execute other git functions via git bash right? |
I have the same issue of I use Git Extensions on Windows for all git commands (commit, push, pull). I had 2 windows open of VS Code and saw that it had an open file handle to the tsconfig.json file. Here's the results from handle and procexp.
PID 12804:
PID 16764:
|
@tonyeung Exactly, Pull and Push sometimes from UI aswell but most of the time I use GIT Bash for repo actions |
Was able to reproduce the tsconfig.json file lock again. Here's the output to
Process Explorer shows this is the command line for PID 16136:
After exiting Visual Studio Code the tsconfig.json file was deleted. |
I think the deletion of the tsconfig.json file makes this a pretty critical bug. The first time it happened it took me a while to figure out what happened. The worse part is that the built in git client didn't pick up the change for a while, so I didn't notice anything missing. If for some reason someone was working without source control it would be a nightmare to figure out why intellisense doesn't work anymore. |
I've seen the same thing with other files (it was a TypeScript file this time):
The file was open inside VS Code. Windows 10. Edit: This might actually be #901. |
@claycephas Thanks a lot for the information. As suspected it is the tsserver that locks the tsconfig.json file. I will open a bug against the TypeScript team. I have one additional question: are you seeing this with the latest VSCode as well (e.g. 0.10.6). This version ships with a new version of the tsserver. |
Open microsoft/TypeScript#6337 in TS land |
@dbaeumer i just had an issue with the tsconfig.json file again last night.. or was it early this morning.. I'm pretty sure I'm on the latest vs code. |
I'm having a weird problem with tsconfig.json when VSCode is open. If I do a All git commands are issued by commandline (ie: not through VSCode). I think this is caused by VSCode locking the tsconfig file so git can't overwrite it or something, and it eventually ends up deleted. If VSCode is closed, this doesn't happen. However, no git errors ever occur and I don't notice until my tsc commands fail or I do a VSCode 0.10.6, git v2.5.1-windows.1 |
Ah, thank you for the update. I understand now. |
vscode keeps deleting my tsconfig.json whenever I checkout a new git branch |
@pocesar: could it be that git deletes it. We don't have any logic in regards to git operations. (e.g. what happens if you checkout the branch without having VSCode open) |
@dbaeumer nope, tsconfig.json is on all of my branches. when vscode is closed, the tsconfig.json is kept intact, when vscode is open, I always need need to reset it |
@pocesar: is your repository public so that I can try to reproduce. |
@claycephas did you run a git operation when that happened (e.g. switching branches). I think the deletion of the tsconfig.json file happens as follows:
|
@dbaeumer it's private, but like was demonstrated by other people in here, it's fairly easy to reproduce. I opened the Devtools inside vscode, and caught this error intellisense for Typescript stops completely, even though my build task is running |
@dbaeumer, the command I was running was |
@dbaeumer I can reproduce on Windows 10. Here are some things I see that are weird:
I am puzzled what kind of difference it could make to run 0.10.6 built or "out of dev" with regards to file locking. |
As puzzles as I am :-). As said today I was not able to reproduce this in the upcoming 0.10.7-dev build with the identical tsserver bits. When testing under 0.10.6 I noticed that the first file the tsserver reads get locked. But I have no explanation for it. @bpasero you mentioned today that you disabled asar support. Could it be that asar support is still on in 0.10.6 when using code.exe as a node environment and in 0.10.7 it is off. That could be an explanation for the behavior. |
@dbaeumer I reverted my change for noasar and it did not make a difference. Unfortunately I am not able to easily switch back to the Electron we shipped in 0.10.6 because of all the API changes in Electron that I adopted, otherwise we could nail this down more easily. Btw I also once commented out all file watching code in TS-Server and could still reproduce the file locking issue, so it seems to be unrelated. |
@bpasero yes, it is unrelated to file watching. I was able to reproduce on 0.10.6 with a simple fs.readFileSync but not on 0.10.7. |
I will close this as fixed for 0.10.7 since all test cases we have that fail on 0.10.6 pass on 0.10.7 although we don't have the final answer why. @bpasero can you please marked as verified. |
This problem is in all Electron based editors. Atom has the same probs. So the real problem lays in the way Electron (Nodejs?) opens files on Windows. It should open them with no lock of course. |
I am attempting to use a separate git client and it keeps complaining about the tsconfig.json file being locked. If I close the folder from Visual Studio Code, the file is unlocked but also deleted.
It looks like Visual Studio Code is somehow locking the tsconfig.json file.
Expected:
Allow other applications to read and write the tsconfig.json file even if the folder containing that file is open in Visual Studio Code.
Environment:
Visual Studio Code:
OS: Windows 7
The text was updated successfully, but these errors were encountered: