Git in Visual Studio 2017 is extremely slow

2

I did the basic checks like not having folders on network drives, changing certain git config settings, using a different repo, anti virus scan ect.

So far I know the problem isn't tied to my Windows account. On another device it only takes a few seconds to switch branches, not a minute. We noticed a lot more network traffic on the slow PC.

When I run Visual Studio in safe mode,

devenv.exe /SafeMode

I immediately see the following errors in the Team Explorer:

System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
   at Microsoft.TeamFoundation.Git.Provider.ServiceProviderExtensionMethods.EnsurePackageLoaded(IServiceProvider serviceProvider, Guid packageGuid)
   at Microsoft.TeamFoundation.Git.Provider.ServiceProviderExtensionMethods.EnsureSccAndTfPackagesLoaded(IServiceProvider serviceProvider)
   at Microsoft.TeamFoundation.Git.Provider.Repositories.GitTeamProjectExtendedInfoProvider.set_ServiceProvider(IServiceProvider value)
   at Microsoft.VisualStudio.TeamFoundation.TeamExplorer.ConnectPage.ConnectPageVS.Initialize(Object sender, PageInitializeEventArgs e)
   at Microsoft.TeamFoundation.Controls.WPF.TeamExplorer.Framework.TeamExplorerPageHost.Initialize(TeamExplorerPageContext context)

As suggested on msdn, the first thing I tried was:

devenv.exe /updateConfiguration

but this did not fix the problem. Then I ran:

devenv.exe /setup

It gives the following error message:

The operation could not be completed. The requested operation requires elevation.

devenv.exe /SafeMode /log D:\temp

The errors I see in the log are:

Error loading UI library for package WebEditorPackage. HrLoadNativeUILibrary failed with 0x800a006f.
Error loading UI library for package Microsoft.VsSDK.ExtensibilityProjectFlavor.ExtensibilityProjectFlavorPackage. HrLoadNativeUILibrary failed with 0x800a006f.
Failed to find CTMENU resource '#1000' in loaded UI library.

I ran Visual Studio as administrator. The problem persists but I don't have any error lines in the log anymore when running as user in safemode afterwards.

I see one error and many warnings on a regular startup:

ERROR Encountered an ArgumentException when trying to look up the key binding information for ({ef254ccf-cee3-43e9-a22c-3ae3ab08e7fe},256) in the scope {5efc7975-14bc-11cf-9b2b-00aa00573819}.
Unexpected system error mode before loading package [Microsoft.VisualStudio.Services.Promotions.PromotionsPackage]
Unexpected system error mode before loading package [InstallerPackage]
About to block on async service creation because the service was requested via GetService. This has the potential to deadlock. Async initializing services should be retrieved via GetServiceAsync.

PkgDef syntax or I/O error at line 1: Section header: additional characters after closing bracket
      [$RootKey$\Setup\[ProductName]]  80004005 - E_FAIL
PkgDef syntax or I/O error at line 3: Section header: additional characters after closing bracket
      "SrcPath"="[SourceDir]"  80004005 - E_FAIL
Could not process PkgDef file
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Community\Detection_Keys_Reg.pkgdef 

A Visual Studio repair did not fix the problem either. I'm using Visual Studio 15.6.5.


I ran sfc to check Windows system files.

sfc /scannow

Beginning system scan.  This process will take some time.

Beginning verification phase of system scan.
Verification 100% complete.

Windows Resource Protection found corrupt files but was unable to fix some
of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For
example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not
supported in offline servicing scenarios.

There are many errors like these:

CSI    000010f2 [DIRSD OWNER WARNING] Directory [l:48 ml:49]'\??\C:\Program Files\Windows Identity Foundation' is not owned but specifies SDDL in component c2wtsres, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35}
CSI    000010f3 [DIRSD OWNER WARNING] Directory [l:53 ml:54]'\??\C:\Program Files\Windows Identity Foundation\v3.5' is not owned but specifies SDDL in component c2wtsres, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35}
CSI    000010f4 Error - Overlap: Duplicate ownership for directory \??\C:\Program Files\Windows Identity Foundation in component c2wtsres, version 10.0.14393.0, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35}
CSI    000010f5 Error - Overlap: Duplicate ownership for directory \??\C:\Program Files\Windows Identity Foundation\v3.5 in component c2wtsres, version 10.0.14393.0, arch amd64, nonSxS, pkt {l:8 b:31bf3856ad364e35}

The Process Monitor logs show switching between Git and VS. The disk operations itself are fast, but after git.exe FileCloses C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin\git.exe it takes almost exactly a second before it closes C:\Windows. And almost a second after a QueryNameInformationFile event from git.exe, it does CloseFile on C:\Windows\System32\conhost.exe.

I made Wireshark captures when there is nothing special going on. I see a lot of traffic between my PC and webdefence.cluster-x.websense.net, the company proxy. The traffic is exceptionally more than what my colleagues have and they don't see errors.

Wireshark log webdefence.cluster-x.websense.net

The problem stays the same when using the wired, wireless or at home with the VPN connection.

I'm suspecting it is a problem with NTFS permissions?


I tried running SFCFix to no avail.

SFCFix Has Crashed


Something has gone horribly wrong and SFCFix has crashed. Would you like SFCFix
to submit a crash report to the developer so that this problem can be fixed?
Type "y" for yes or "n" for no and press enter to continue:

The other tools I tried weren't successful yet either.

D:\Tools>DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase

Deployment Image Servicing and Management tool
Version: 10.0.14393.0

Image Version: 10.0.14393.0

[===========                20.0%                          ]
The operation completed successfully.

D:\Tools>Dism /Online /Cleanup-Image /RestoreHealth

Deployment Image Servicing and Management tool
Version: 10.0.14393.0

Image Version: 10.0.14393.0

[==========================100.0%==========================]
Error: 0x800f081f

The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.

The DISM log file can be found at C:\WINDOWS\Logs\DISM\dism.log

Tweaking.com - Windows Repair 2018 was not able to fix the file permissions either.

git
visual-studio
visual-studio-2017
ntfs
asked on Stack Overflow Apr 10, 2018 by ofthelit • edited Apr 17, 2018 by ofthelit

2 Answers

2

delete "Git" folder in this directory and restart VS

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer

that folder overrides your normal Git executions.

PS: if you are using not "Community" version then modify accordingly. Cheers

answered on Stack Overflow May 31, 2019 by Guven Sezgin Kurt
0

It is probably a hardware problem in this Lenovo L460 - e-ID reader i7 SSD.

The system got restaged. SFC found some errors and could fix them. The traffic in Wireshark looks normal but the problem persists. A colleague logging in on the system for the first time has the same problem.

The only other thing I noticed is when the Opera browser starts up, it is impossible to display a new webpage within the first minute. The website keeps loading a long time.

answered on Stack Overflow Apr 20, 2018 by ofthelit

User contributions licensed under CC BY-SA 3.0