Hello! Please read the contributing guidelines before submitting an issue regarding the GitHub Extension for Visual Studio.
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.
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.
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
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.
@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.
@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.
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.
@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:
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!
Here are a couple of instances where it happens:


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.
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

@jcansdale Thanks for following up and it appears an initial diagnosis as well.
@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
@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. 馃槃
@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
@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
This issue started happening when we moved to libgit2sharp v0.24.0 (see #1315).