This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 14
14
using System . Diagnostics ;
15
15
using System . Threading ;
16
16
using tasks = System . Threading . Tasks ;
17
+ using Microsoft . VisualStudio . ComponentModelHost ;
17
18
18
19
namespace GitHub . VisualStudio
19
20
{
@@ -75,6 +76,7 @@ public GHClient(IProgram program)
75
76
}
76
77
}
77
78
79
+ [ NullGuard . NullGuard ( NullGuard . ValidationFlags . None ) ]
78
80
[ PackageRegistration ( UseManagedResourcesOnly = true , AllowsBackgroundLoading = true ) ]
79
81
[ ProvideService ( typeof ( IUIProvider ) , IsAsyncQueryable = true ) ]
80
82
[ ProvideAutoLoad ( UIContextGuids . NoSolution ) ]
@@ -126,11 +128,15 @@ protected override async tasks.Task InitializeAsync(CancellationToken cancellati
126
128
}
127
129
}
128
130
129
- tasks . Task < object > CreateService ( IAsyncServiceContainer container , CancellationToken cancellationToken , Type serviceType )
131
+ async tasks . Task < object > CreateService ( IAsyncServiceContainer container , CancellationToken cancellationToken , Type serviceType )
130
132
{
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 ) ) ;
134
140
}
135
141
}
136
142
}
You can’t perform that action at this time.
0 commit comments