This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1414using System . Diagnostics ;
1515using System . Threading ;
1616using tasks = System . Threading . Tasks ;
17+ using Microsoft . VisualStudio . ComponentModelHost ;
1718
1819namespace GitHub . VisualStudio
1920{
@@ -75,6 +76,7 @@ public GHClient(IProgram program)
7576 }
7677 }
7778
79+ [ NullGuard . NullGuard ( NullGuard . ValidationFlags . None ) ]
7880 [ PackageRegistration ( UseManagedResourcesOnly = true , AllowsBackgroundLoading = true ) ]
7981 [ ProvideService ( typeof ( IUIProvider ) , IsAsyncQueryable = true ) ]
8082 [ ProvideAutoLoad ( UIContextGuids . NoSolution ) ]
@@ -126,11 +128,15 @@ protected override async tasks.Task InitializeAsync(CancellationToken cancellati
126128 }
127129 }
128130
129- tasks . Task < object > CreateService ( IAsyncServiceContainer container , CancellationToken cancellationToken , Type serviceType )
131+ async tasks . Task < object > CreateService ( IAsyncServiceContainer container , CancellationToken cancellationToken , Type serviceType )
130132 {
131- AssemblyResolver . InitializeAssemblyResolver ( ) ;
132- var ret = Services . ComponentModel . DefaultExportProvider . GetExportedValueOrDefault < IUIProvider > ( ) ;
133- return tasks . Task . FromResult ( ( object ) ret ) ;
133+ if ( serviceType == null )
134+ return null ;
135+ string contract = AttributedModelServices . GetContractName ( serviceType ) ;
136+ var cm = await GetServiceAsync ( typeof ( SComponentModel ) ) as IComponentModel ;
137+ if ( cm == null )
138+ return null ;
139+ return await tasks . Task . Run ( ( ) => cm . DefaultExportProvider . GetExportedValueOrDefault < object > ( contract ) ) ;
134140 }
135141 }
136142}
You can’t perform that action at this time.
0 commit comments