@@ -13,11 +13,11 @@ namespace System.CommandLine.Invocation
1313{
1414 internal class ServiceProvider : IServiceProvider
1515 {
16- private readonly Dictionary < Type , Func < IServiceProvider , object > > _services ;
16+ private readonly Dictionary < Type , Func < IServiceProvider , object ? > > _services ;
1717
1818 public ServiceProvider ( BindingContext bindingContext )
1919 {
20- _services = new Dictionary < Type , Func < IServiceProvider , object > >
20+ _services = new Dictionary < Type , Func < IServiceProvider , object ? > >
2121 {
2222 [ typeof ( ParseResult ) ] = _ => bindingContext . ParseResult ,
2323 [ typeof ( IConsole ) ] = _ => bindingContext . Console ,
@@ -29,18 +29,18 @@ public ServiceProvider(BindingContext bindingContext)
2929
3030 public void AddService < T > ( Func < IServiceProvider , T > factory ) => _services [ typeof ( T ) ] = p => factory ( p ) ! ;
3131
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 ;
3333
3434 public IReadOnlyCollection < Type > AvailableServiceTypes => _services . Keys ;
3535
36- public object GetService ( Type serviceType )
36+ public object ? GetService ( Type serviceType )
3737 {
3838 if ( _services . TryGetValue ( serviceType , out var factory ) )
3939 {
4040 return factory ( this ) ;
4141 }
4242
43- return null ! ;
43+ return null ;
4444 }
4545 }
4646}
0 commit comments