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

Git: Cannot read property 'resourceUri' of undefined #35724

Closed
mxschmitt opened this issue Oct 6, 2017 · 40 comments
Closed

Git: Cannot read property 'resourceUri' of undefined #35724

mxschmitt opened this issue Oct 6, 2017 · 40 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues verified Verification succeeded
Milestone

Comments

@mxschmitt
Copy link
Member

mxschmitt commented Oct 6, 2017

  • VSCode Version: Code - Insiders 1.17.0-insider (7ac1f1e, 2017-09-30T05:06:21.234Z)
  • OS Version: Windows_NT x64 6.1.7601
  • Extensions:
Extension Author (truncated) Version
vscode-eslint dba 1.3.2
githistory don 0.2.3
xml Dot 1.9.2
Go luk 0.6.66
code-beautifier mic 1.7.2
vscode-icons rob 7.14.0
vscode-table-formatter shu 1.2.1
addDocComments ste 0.0.8

(1 theme extensions excluded)


Steps to Reproduce:

  1. Open the Git Sidebar
  2. Click on the 'Discard changes' button filename: fetch.go
  3. Then the following error occurs:
    image

Developer Tools:
image

Reproduces without extensions: Yes/No

@vscodebot vscodebot bot added the extensions Issues concerning extensions label Oct 6, 2017
@mxschmitt
Copy link
Member Author

mxschmitt commented Oct 6, 2017

Looks like that this is the same problem like in #33819 and #33389

@chrmarti
Copy link
Contributor

chrmarti commented Oct 6, 2017

Must be a new issue since you are on 1.17.0.

@chrmarti chrmarti added scm General SCM compound issues and removed extensions Issues concerning extensions labels Oct 6, 2017
@pftbest
Copy link

pftbest commented Oct 8, 2017

Version 1.17.0 (1.17.0)

Git: Cannot read property 'resourceUri' of undefined
e.doShow @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:28

@joaomoreno joaomoreno added git GIT issues and removed scm General SCM compound issues labels Oct 9, 2017
@joaomoreno
Copy link
Member

@maxibanki @pftbest Does the issue reproduce easily?

@joaomoreno joaomoreno added the info-needed Issue requires more information from poster label Oct 11, 2017
@mxschmitt
Copy link
Member Author

It happened just one time while i was on work. No way to reproduce it currently as i know.

@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Oct 11, 2017
@joaomoreno joaomoreno added this to the Backlog milestone Oct 11, 2017
@aekasitt
Copy link

Happening as I am typing this.
I tried to press + to add a file that already exists in the Git repo and this error kept popping up. And it did not go away so I typed "git commit -am '[commit-message]'" into the console and could commit just fine, however adding using the GUI caused the problem as seen in the screenshot.

screen shot 2017-10-11 at 3 42 37 pm

Hope this helps
I have included the output console in the screenshot to show as much as possible.

@Sumo-MBryant
Copy link

One workaround I found was to open a different folder, and then go back to opening the original folder.

The issue appeared to fix itself then.

@AntoineDrouhin
Copy link

Same message when trying to stage changes done in an untracked folder.

Worked around it by manually adding the folder with git add folderName/

@joaomoreno joaomoreno modified the milestones: Backlog, October 2017 Oct 18, 2017
@joshSummerhays
Copy link

Having this issue when trying to stage changes as well as clicking on the file and trying to see the diff. Worked smoothly before an update

@pftbest
Copy link

pftbest commented Oct 21, 2017

It happened to me twice yesterday, and in both cases i was editing files that where outside of current workspace but in the same git repo.

@simon-r
Copy link

simon-r commented Oct 23, 2017

It happened with c++ when I've tried to add a new source file.

@Pajn
Copy link

Pajn commented Oct 30, 2017

I have a bunch of files right now project that is like these, but other files are fine. Is hard to reliably reproduce as only some files sometimes becomes problematic. If I restart vscode all files can be fine. I've seen this in multiple projects which differ quite a bit so I have no idea what the common thing could be.

@pranav9196
Copy link

Add the particular files by going to the directory in your terminal(right click on the folder in your project and open it in terminal) and add all the files you want.

@klj890
Copy link

klj890 commented Nov 1, 2017

me too

@usman-liaquat
Copy link

try to perform action using terminal, it worked for me,

@joaomoreno
Copy link
Member

This seems very hard for me to reproduce. It's very possible that 9e9f809 fixed it. But not sure...

I'l close it for now. Please try the latest Insiders release or the upcoming November stable release (available next week) and let me know if you still see the issue.

@mjbvz mjbvz added the verified Verification succeeded label Nov 3, 2017
@mxschmitt
Copy link
Member Author

mxschmitt commented Nov 7, 2017

@joaomoreno I had the issue again with this version:

  • VSCode Version: Code - Insiders 1.18.0-insider (098bb77, 2017-11-04T04:43:03.436Z)
  • OS Version: Windows_NT x64 6.1.7601

So the commit 9e9f809 doesn't fixed the issue.
Here some details, which maybe helps you to reproduce it better:

I opened the SCM sidebar and tried to type in a Git commit message. After that I want to view the difference for some files.
image
All files worked fine to see the difference except the package.json. When I try to click on the file, no error appears. Also the Stage Changes and the Discard button works fine except on the package.json. In this example the files had a difference where the last line got removed. (I checked it via the git diff command from the command line). When I clicked on the Stage Changes and the Discard button the error message from the issue title appears via a Message on the top.

@joaomoreno joaomoreno reopened this Nov 8, 2017
@joaomoreno joaomoreno removed the verified Verification succeeded label Nov 8, 2017
@joaomoreno joaomoreno modified the milestones: October 2017, November 2017 Nov 8, 2017
@joshSummerhays
Copy link

on version 1.18.0 as well. sporadic but a lot of files I can't stage changes or view the changes. Git: Cannot read property 'resourceUri' of undefined. +1 to make this high priority

@davidsielert
Copy link

Getting this aswell on 1.18.0, seems hard to reproduce

@MarcusAhlfors
Copy link

MarcusAhlfors commented Nov 14, 2017

Me too for 1.18.0, if I have eg. 10 files to commit there is certainly at least one of them which fails with this message

@joekrill
Copy link

This has actually gotten seemingly worse for me since my most recent update (1.18.0). Not only am I seeing the resourceUri error, but in some cases I can't even open the file from the source control tab. Right now I have a file in "Changes" and double clicking it does nothing -- it doesn't open it (or the diff), and I don't even get any sort of error. If I try to stage it I still get the "Git: Cannot read property 'resourceUri' of undefined" error message."

As everyone else is reporting, using the command line works just fine (and the source control tab updates accordingly), so it's not a huge problem for me, just a minor annoyance.

Unfortunately I haven't found a reliable way to reproduce this, but it's happening often enough for me that if anyone has any ideas I'm happy to test them out.

@joaomoreno
Copy link
Member

Guys, if you open the Developer Tools, is there any warning in there?

@gigouni
Copy link

gigouni commented Nov 15, 2017

Another possible workaround: pass by your terminal and add manually the file
git add <your-file>

VS Code
Version 1.18.0
Commit dcee220
Date 2017-11-08T12:44:48.751Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

You'll be able to see the differences through the editor then.

@Pajn
Copy link

Pajn commented Nov 15, 2017

This has actually gotten seemingly worse for me since my most recent update (1.18.0). Not only am I seeing the resourceUri error, but in some cases I can't even open the file from the source control tab.

Hmm, for me it has always been that way. However the file can still be opened from the file tree.

@joaomoreno
Copy link
Member

Questions for those who hit this:

  • Is there any special output in the Developer Tools when this happens?
  • Do you have more than a single SCM repository in the SCM view?

@mxschmitt
Copy link
Member Author

In my case only the output (of the first post in this issue) was logged. I haven't used or installed any other SCM provider.

@joekrill
Copy link

I get this in the Developer Tools console when a file won't open:

screen shot 2017-11-15 at 8 05 35 pm

And to answer your other question @joaomoreno - I only have one SCM repository.

@simon-r
Copy link

simon-r commented Nov 16, 2017

The bug is there!
Arch Linux and VSCODE 1.18.0

When I've tried to stage only with some (apparently random) files I've had the problem.

Recently also the git.autorefresh does not work!
I've set in my config git.autorefresh": true .

@simon-r
Copy link

simon-r commented Nov 16, 2017

In the developper tools i've found this:

messageService.ts:126 GIT: Cannot read property 'resourceUri' of undefined
e.doShow @ messageService.ts:126

@hknoerrer
Copy link

hknoerrer commented Nov 16, 2017

Also available on OSX 10.12.6 vscode 1.18.0

Tried to add a modified file to stage.
Shortly after i added other files to stage without a problem.
Then i retried to add the "problem" file and got the error again.

got two messages:

messageService.ts:126 Git: Cannot read property 'resourceUri' of undefined
e.doShow @ messageService.ts:126
e.show @ messageService.ts:105
e._showMessage @ mainThreadMessageService.ts:72
n.Class.derive._oncancel @ winjs.base.raw.js:1641
e._showMessage @ mainThreadMessageService.ts:42
e.$showMessage @ mainThreadMessageService.ts:36
e.invoke @ abstractThreadService.ts:41
e._invokeHandler @ rpcProtocol.ts:109
e._receiveOneMessage @ rpcProtocol.ts:96
(anonymous) @ rpcProtocol.ts:32
(anonymous) @ rpcProtocol.ts:157
e.invoke @ callbackList.ts:36
e.fire @ event.ts:123
(anonymous) @ ipc.net.ts:82
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560
messageService.ts:126 Git: Cannot read property 'resourceUri' of undefined
e.doShow @ messageService.ts:126
e.show @ messageService.ts:105
e._showMessage @ mainThreadMessageService.ts:72
n.Class.derive._oncancel @ winjs.base.raw.js:1641
e._showMessage @ mainThreadMessageService.ts:42
e.$showMessage @ mainThreadMessageService.ts:36
e.invoke @ abstractThreadService.ts:41
e._invokeHandler @ rpcProtocol.ts:109
e._receiveOneMessage @ rpcProtocol.ts:96
(anonymous) @ rpcProtocol.ts:32
(anonymous) @ rpcProtocol.ts:157
e.invoke @ callbackList.ts:36
e.fire @ event.ts:123
(anonymous) @ ipc.net.ts:82
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560

console.ts:123 [Extension Host] ApplicationInsights:Sender [Object]0: Objectaddress: "40.77.226.250"code: "ECONNREFUSED"errno: "ECONNREFUSED"port: 443syscall: "connect"proto: Objectconstructor: function Object()hasOwnProperty: function hasOwnProperty()isPrototypeOf: function isPrototypeOf()propertyIsEnumerable: function propertyIsEnumerable()toLocaleString: function toLocaleString()toString: function toString()valueOf: function valueOf()defineGetter: function defineGetter()defineSetter: function defineSetter()lookupGetter: function lookupGetter()lookupSetter: function lookupSetter()get proto: function proto()set proto: function proto()length: 1__proto__: Array(0)concat: function concat()constructor: function Array()copyWithin: function copyWithin()entries: function entries()every: function every()fill: function fill()filter: function filter()find: function find()findIndex: function findIndex()forEach: function forEach()includes: function includes()indexOf: function indexOf()join: function join()keys: function keys()lastIndexOf: function lastIndexOf()length: 0map: function map()pop: function pop()push: function push()reduce: function reduce()reduceRight: function reduceRight()reverse: function reverse()shift: function shift()slice: function slice()some: function some()sort: function sort()splice: function splice()toLocaleString: function toLocaleString()toString: function toString()unshift: function unshift()Symbol(Symbol.iterator): function values()Symbol(Symbol.unscopables): Object__proto__: Object
t.log @ console.ts:123
t._logExtensionHostMessage @ extensionHost.ts:377
(anonymous) @ extensionHost.ts:202
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104

@ufthelp
Copy link

ufthelp commented Nov 16, 2017

Faced the same issue on below enviornment:-

  • Mac OS - 10.12.6

  • VS code - Version 1.15.1 (1.15.1)

Steps:- Made changes to launch.json file but on discarding the changes its showing the error.

vscodeerror

@joaomoreno
Copy link
Member

joaomoreno commented Nov 17, 2017

OK GUYS! I got it, finally.

homer

Steps:

  1. Have 4 unstaged files: file1.txt, file2.txt, file3.txt, file4.txt.
  2. In the terminal, type git add file1.txt file3.txt
  3. Using the UI, stage file2.txt then unstage it. Repeat this 5 more times.
  4. Try clicking on file4.txt or any of its actions.

spongebob

Keep reading for a postmortem analysis.


Here's where the bug is:

https://github.com/Microsoft/vscode/blob/0a42516de80d3141955114678b5736c5d124f796/src/vs/workbench/api/node/extHostSCM.ts#L265

We're basically dealing with a list of changes, sorted by the occurring index in the original sequence, and applying the same changes into a another list. This, of course, is a problem if the difference between the number of inserted elements is different than the number of deleted elements in that change, since the index positions for the following changes will all be wrong. The usual way to do this is to reverse the list of changes and apply them in that order. We do this in the main thread:

https://github.com/Microsoft/vscode/blob/0a42516de80d3141955114678b5736c5d124f796/src/vs/workbench/api/electron-browser/mainThreadSCM.ts#L179

But we overlooked doing the same when dealing with the _handlesSnapshot array.

Combine that with the fact that we only really dispose these guys 10 times after a resource group was effectively modified (that's why step 3 of the repro steps needs to be repeated 5 times), this bug proved to be a very elusive one.

lesson


I'll fix the order of handling these splices. I'll also remove the 10 generations before disposing... we can deal with that in some other way.

@MattGoldwater
Copy link

MattGoldwater commented Nov 22, 2017

Should this error be gone in the most recently shipped version? (I'm not using the insiders build) I just got it.

@joaomoreno
Copy link
Member

joaomoreno commented Nov 23, 2017

git tag --contains 9752f3c returns empty... so: no.

This fix is already out in Insiders but will come in the next Stable (1.19.0).

@gillez
Copy link

gillez commented Nov 30, 2017

Any idea when Stable v1.19.0 will be released? I'm seeing this error often and it's beginning to get annoying. :)

@mxschmitt
Copy link
Member Author

mxschmitt commented Nov 30, 2017

Should be released in the next one or two weeks

@joaomoreno
Copy link
Member

#38268

@atcraigwatson
Copy link

I have just had this happen when staging multiple files, I followed some advice seen above, changed folder, came back to project and all is well.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests