@@ -86,14 +86,22 @@ public async Task Clone(
8686 NavigateToHomePage ( teamExplorer ) ; // Show progress on Team Explorer - Home
8787 await WaitForCloneOnHomePageAsync ( teamExplorer ) ;
8888#elif TEAMEXPLORER15 || TEAMEXPLORER16
89+ // IGitActionsExt is proffered by SccProviderPackage, but isn't advertised.
90+ // To ensure that getting IGitActionsExt doesn't return null, we first request the
91+ // IGitExt service which is advertised. This forces SccProviderPackage to load
92+ // and proffer IGitActionsExt.
93+ var gitExt = serviceProvider . GetService ( typeof ( IGitExt ) ) ;
94+ Assumes . NotNull ( gitExt ) ;
95+ var gitActionsExt = serviceProvider . GetService < IGitActionsExt > ( ) ;
96+ Assumes . NotNull ( gitActionsExt ) ;
97+
8998 // The progress parameter uses the ServiceProgressData type which is defined in
9099 // Microsoft.VisualStudio.Shell.Framework. Referencing this assembly directly
91100 // would cause type conflicts, so we're using reflection to call CloneAsync.
92- var gitExt = serviceProvider . GetService < IGitActionsExt > ( ) ;
93101 var cloneAsyncMethod = typeof ( IGitActionsExt ) . GetMethod ( nameof ( IGitActionsExt . CloneAsync ) ) ;
94102 Assumes . NotNull ( cloneAsyncMethod ) ;
95103 var cloneParameters = new object [ ] { cloneUrl , clonePath , recurseSubmodules , cancellationToken , progress } ;
96- var cloneTask = ( Task ) cloneAsyncMethod . Invoke ( gitExt , cloneParameters ) ;
104+ var cloneTask = ( Task ) cloneAsyncMethod . Invoke ( gitActionsExt , cloneParameters ) ;
97105
98106 NavigateToHomePage ( teamExplorer ) ; // Show progress on Team Explorer - Home
99107 await cloneTask ;
0 commit comments