@@ -13,11 +13,11 @@ namespace System.CommandLine.Invocation
13
13
{
14
14
internal class ServiceProvider : IServiceProvider
15
15
{
16
- private readonly Dictionary < Type , Func < IServiceProvider , object > > _services ;
16
+ private readonly Dictionary < Type , Func < IServiceProvider , object ? > > _services ;
17
17
18
18
public ServiceProvider ( BindingContext bindingContext )
19
19
{
20
- _services = new Dictionary < Type , Func < IServiceProvider , object > >
20
+ _services = new Dictionary < Type , Func < IServiceProvider , object ? > >
21
21
{
22
22
[ typeof ( ParseResult ) ] = _ => bindingContext . ParseResult ,
23
23
[ typeof ( IConsole ) ] = _ => bindingContext . Console ,
@@ -29,18 +29,18 @@ public ServiceProvider(BindingContext bindingContext)
29
29
30
30
public void AddService < T > ( Func < IServiceProvider , T > factory ) => _services [ typeof ( T ) ] = p => factory ( p ) ! ;
31
31
32
- public void AddService ( Type serviceType , Func < IServiceProvider , object > factory ) => _services [ serviceType ] = factory ;
32
+ public void AddService ( Type serviceType , Func < IServiceProvider , object ? > factory ) => _services [ serviceType ] = factory ;
33
33
34
34
public IReadOnlyCollection < Type > AvailableServiceTypes => _services . Keys ;
35
35
36
- public object GetService ( Type serviceType )
36
+ public object ? GetService ( Type serviceType )
37
37
{
38
38
if ( _services . TryGetValue ( serviceType , out var factory ) )
39
39
{
40
40
return factory ( this ) ;
41
41
}
42
42
43
- return null ! ;
43
+ return null ;
44
44
}
45
45
}
46
46
}
0 commit comments