Change:
VSCode Version: 1.39 OS Version: Darwin x64 18.7.0 This doesn't happen consistently, but every once in a while, this feature would completely crash and I'd have to restart my editor. The steps are as follows: I open a folder, I start editing some code. I right click the tab name, and click . The whole File explorer is highlighted in blue, without my file actually getting highlighted. I checked the dev tools, and here is the error that gets shown: I traced it down to this line: Which indiates that tree items are refreshed/updated somehow, but the key used to look up this map is still referring to the old object? Should this map be indexed by something else? item id (string)?
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.478 --- <!-- score: 0.455 --<!-- potentialduplicatescomment --
^ these seem unrelated/already closed before that release. cc
first of all thanks for nice description. If we get more precise steps that would be great since we are tracking this issue down quite some time. This is not a regression, thus I will assign this to next milestone October to look into the fix. fyi for ideas on what additional data we might need here
I couldn't get exact repro steps :( this happens randomly every once in a while, and the only remedy I have is to reload VSCode. Not sure it is a regression or not. It has been there for many weeks.
Let me know if you find better repro steps!
Does anybody working on it? I want to investigate it.
I reproduced it (though it requires some code instrumentation to make the race condition occur more often): You need a folder which is deep enough in the workspace with at least two files. Split the editor open one editor in one half, the other in the other half. Create the following script in the root directory: Create the following function in the following file: And add its call to the following place: Run the script. Then quickly switch between editors left and right. You will have the console full of these errors in a minute or two.
My thoughts on how to resolve it: We need to check whether item we are sent is valid or not What to do if it's not? The first idea is to retry, but might it live to livelocks? I.e. if a user uses remote extension over a sketchy connection?
Also, notice that there're two places where exception arises. It happens both in reveal and expand.
I reread the description, and it seems that I don't have the tree highlighted in blue. Though, I used the master version for the fix.
Checked, the tree is functional after such an exception.
Cool. But this doesn't seem to nail the exact issue reported by the user since it was originally reported that:
I fixed it on the master version, so it might have been alleviated by some fixes. Also, we have our internal users reporting an issue, when the item isn't selected even though, the editor is switched which seems to be very similar to what the PR fixes. I talked to about this and it seems that the original issue might be the same as that one.
We have merged a PR which potentially fixes this. Please try it out with VS Code insiders from Thursday and provide feedback here if it is behaving better. Thank you very much
Let me reopen since the PR probably does not fix the original isssue. If we are mistaken, do let us know
I had this issue on one of stable version of recently. It was just a file not revealed in the tree, and not completely unusable tree as Omar described.
Just happened to me again, next time it happens I'll try debug into and see if I can get more info.
This issue has been closed automatically because it needs more information and has not had recent activity. See also our guidelines. Happy Coding!
This issue has been closed automatically because it needs more information and has not had recent activity. See also our guidelines. Happy Coding!
looks like it was closed by mistake?
Had the same issue today with the last stable version. The fix given here worked, so maybe it's a regression? I'm using it with WSL2 and the Remote-WSL extension.
This should be fixed now with latest vscode insdiers since I rewrote parts of exlporer responsible for this. If you still see this please let me know and we can reopen this issue

Discussion:
return withNullAsUndefined(toResource(input, { supportSideBySide: SideBySideEditor.MASTER })); } <del> private async onSelectResource(resource: URI | undefined, reveal = this.autoReveal): Promise<void> { </del> <ins> private async onSelectResource(resource: URI | undefined, reveal = this.autoReveal, retry = 0): Promise<void> { // do no retry more than once to prevent inifinite loops in cases of inconsistent model if (retry === 2) { return; } </ins> if (!resource || !this.isBodyVisible()) { return; }

.sort((first, second) => second.resource.path.length - first.resource.path.length)[0]; while (item && item.resource.toString() !== resource.toString()) { <ins> if (item.isDisposed) { return this.onSelectResource(resource, reveal, retry + 1); } </ins> await this.tree.expand(item); item = first(values(item.children), i => isEqualOrParent(resource, i.resource)); } if (item && item.parent) { if (reveal) { <ins> if (item.isDisposed) { return this.onSelectResource(resource, reveal, retry + 1); } </ins> this.tree.reveal(item, 0.5); }

export class ExplorerItem { private _isDirectoryResolved: boolean; <ins> private _isDisposed: boolean; </ins> public isError = false; constructor(

this._isDirectoryResolved = false; } <ins> get isDisposed(): boolean { return this._isDisposed; } </ins> get isDirectoryResolved(): boolean { return this._isDirectoryResolved; }

if (formerLocalChild) { ExplorerItem.mergeLocalWithDisk(diskChild, formerLocalChild); local.addChild(formerLocalChild); <ins> oldLocalChildren.delete(diskChild.resource); </ins> } // New child: add

local.addChild(diskChild); } }); <ins> for (let child of oldLocalChildren.values()) { child._dispose(); } </ins> } }

} forgetChildren(): void { <ins> for (let c of this.children.values()) { c._dispose(); } </ins> this.children.clear(); this._isDirectoryResolved = false; } <ins> private _dispose() { this._isDisposed = true; for (let child of this.children.values()) { child._dispose(); } } </ins> private getPlatformAwareName(name: string): string { return (!name || !resources.hasToIgnoreCase(this.resource)) ? name : name.toLowerCase(); }