Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

GitHub extension crashes when viewing pull requests #1306

Closed
awbushnell opened this issue Nov 8, 2017 · 16 comments
Closed

GitHub extension crashes when viewing pull requests #1306

awbushnell opened this issue Nov 8, 2017 · 16 comments

Comments

@awbushnell
Copy link

Hello! Please read the contributing guidelines before submitting an issue regarding the GitHub Extension for Visual Studio.

  • GitHub Extension for Visual Studio version: 2.3.4.54
  • Visual Studio version: VS2017 Professional version 15.4.3

I have been experiencing issues with GitHub extension and seems particular to our repository/history. Our repo is fairly large. What I am finding is I am unable to view pull requests inside Visual Studio, attempting to do so, results in GitHub spinning away for awhile and eventually Visual Studio simply crashes and I am offered by Windows to restart or debug it.. Any ideas on how to help debug this etc. would be great.

@grokys
Copy link
Contributor

grokys commented Nov 9, 2017

Hi @awbushnell,

Is this a publicly available repository that I can try myself? If not, a good start would be to send us the content of your log which can be found at %LocalAppData%\GitHubVisualStudio\extension.log.

@awbushnell
Copy link
Author

awbushnell commented Nov 9, 2017

Hi @grokys ,

This is a private repository. Here is the catch.. I am not seeing an extension.log file where you are stating it should be. What I see is I click on a pull request to view it. the panel updates and a spinning circle appears followed by the Windows prompt that Visual Studio has crashed and do I want to restart or debug. No log is generated etc.. If it is of any help, I am uploading the call stack I see when I choose to debug Visual Studio at the point of crashing.
GitHubcallstack.txt

@grokys
Copy link
Contributor

grokys commented Nov 9, 2017

Thanks for the call stack @awbushnell, that's really helpful - it looks like it's libgit2 that's crashing there when trying to get the status of your local repository.

Do you have another machine you could try this on? I'd like to know if it's maybe a problem with your locally checked out repository or a problem with libgit2 itself.

@awbushnell
Copy link
Author

@grokys I do not have a second machine handy to try. I am doing a clean clone of the repo in question and once completed will try that and report back. One observation I made is that I notice it seems in my Visual Studio 2017 install, I have 2 versions of the libgit2sharp.dll, one under Team Explorer and one under GitHub, not sure that is expected or not but fyi.

@grokys
Copy link
Contributor

grokys commented Nov 9, 2017

@awbushnell I've actually just run into what might be a similar problem with 2.3.4.54, however this problem seems to not be present on our current master build.

Would you be able to try our latest CI build from https://ci.appveyor.com/project/github-windows/visualstudio/branch/master/artifacts? Note that this isn't at all stable and you will probably encounter problems - it's just to see if this particular problem is fixed for you as well.

Having 2 versions of libgit2sharp is normal, as MS doesn't want us using theirs.

@awbushnell
Copy link
Author

GitHubCallStack2.txt
@grokys I cloned our repository to a clean tree and opened that in VS2017. When I did that in GitHub I managed to get a particular PR to open and then I opened it a 2nd time.. I then went to open a 3rd/different one and then I crashed again! The latest callstack for that crash is attached, this time a different dll, but prompted me this time for a source file as noted in the top of the txt file.

GitHubCallStack2.txt

@awbushnell
Copy link
Author

@grokys I tried the latest build you pointed me at. Still crashed. I managed to open 3 or 4 pull requests in succession, but then another attempt crashed. Call stack was again from git2-15e1193.dll as seen:

GitHubCallStack2.txt

@grokys
Copy link
Contributor

grokys commented Nov 9, 2017

Thanks for trying @awbushnell - I installed that version myself and I'm still seeing the crash too. It seems to only happen with Release builds. Investigating further, thanks for your help!

@jcansdale
Copy link
Collaborator

Here are a couple of instances where it happens:

image

image

It appears to be a problem with LibGit2Sharp's RetrieveStatus method.

It's blowing up inside our IsWorkingDirectoryClean method. I'll investigate more and see if it's possible to harden this method.

jcansdale added a commit that referenced this issue Nov 10, 2017
Somehow putting the `repo` object in a `using` avoids the following issue:
#1306
@jcansdale
Copy link
Collaborator

jcansdale commented Nov 10, 2017

It looks like this is a related exception as well:

2017-11-10 13:21:54.919 INFO [01] GitHubPackage             Initializing GitHub Extension v2.3.5.0 in Microsoft Visual Studio 2015 (14.0.25420.1)
2017-11-10 13:23:24.089 EROR [01] PullRequestDetailViewModel Error loading PullRequestModel
LibGit2Sharp.NotFoundException: no submodule named 'submodules/splat'
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_status_list_new(RepositoryHandle repo, GitStatusOptions options)
   at LibGit2Sharp.RepositoryStatus..ctor(Repository repo, StatusOptions options)
   at LibGit2Sharp.RepositoryExtensions.RetrieveStatus(IRepository repository)
   at GitHub.Services.PullRequestService.IsWorkingDirectoryClean(ILocalRepositoryModel repository) in C:\source\github.com\github\VisualStudio\src\GitHub.App\Services\PullRequestService.cs:line 108
   at GitHub.ViewModels.PullRequestDetailViewModel.<Load>d__100.MoveNext() in C:\source\github.com\github\VisualStudio\src\GitHub.App\ViewModels\PullRequestDetailViewModel.cs:line 439

image

@awbushnell
Copy link
Author

@jcansdale Thanks for following up and it appears an initial diagnosis as well.

@awbushnell
Copy link
Author

@jcansdale A follow up question with regards to the exception you found, I take it from that, there for some reason in the repo you are testing with a reference to a 'submodule' that cannot be found? I ask because we have an issue in our repo where a package was integrated and the integrator zipped up the git folder etc. and so Visual Studio at times wants to try and treat it as a submodule but it is not, so just curious if there is maybe a correlation

jcansdale added a commit that referenced this issue Nov 10, 2017
Somehow putting the `repo` object in a `using` avoids the following issue:
#1306
@jcansdale
Copy link
Collaborator

@awbushnell I think the issue is with memory corruption in the native git_status_list_new method rather than anything to do with submodules.

I should have a version for you to try very soon. 😄

@jcansdale
Copy link
Collaborator

jcansdale commented Nov 10, 2017

@awbushnell could you try installing the .vsix listed here and let me know if it resolves the issue?
https://ci.appveyor.com/project/github-windows/visualstudio/build/2.3.5.277/artifacts

@awbushnell
Copy link
Author

@jcansdale Yes!! I have installed the vsix to both Visual Studio 2015 and Visual Studio 2017 on my local system and in both cases, I have been opening pull requests inside the respective IDE, and no crashes etc. seem to be occurring... Let me know when it is "officially" released to the public and I can get our teams updating to it locally

@jcansdale jcansdale changed the title GitHub extension crashes VS2017 when viewing pull requests GitHub extension crashes when viewing pull requests Nov 10, 2017
@jcansdale
Copy link
Collaborator

jcansdale commented Nov 17, 2017

This issue started happening when we moved to libgit2sharp v0.24.0 (see #1315).

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

No branches or pull requests

3 participants