File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public ProviderProbe(string typeName, bool disabled = false)
4343 _creator = new Lazy < IProviderCreator < T > > ( ( ) =>
4444 {
4545 var type = Type . GetType ( typeName ) ;
46- return Activator . CreateInstance ( type ) as IProviderCreator < T > ;
46+ return type is null ? null : Activator . CreateInstance ( type ) as IProviderCreator < T > ;
4747 } , LazyThreadSafetyMode . ExecutionAndPublication ) ;
4848 }
4949
@@ -64,7 +64,13 @@ public T Create()
6464 throw new NotSupportedException ( "Native Provider Probing is disabled by an application switch" ) ;
6565 }
6666
67- return _creator . Value . CreateProvider ( ) ;
67+ var creator = _creator . Value ;
68+ if ( creator is null )
69+ {
70+ throw new NotSupportedException ( "Native Provider Probing failed to resolve creator" ) ;
71+ }
72+
73+ return creator . CreateProvider ( ) ;
6874 }
6975
7076 public T TryCreate ( )
@@ -76,7 +82,7 @@ public T TryCreate()
7682
7783 try
7884 {
79- return _creator . Value . CreateProvider ( ) ;
85+ return _creator . Value ? . CreateProvider ( ) ;
8086 }
8187 catch
8288 {
You can’t perform that action at this time.
0 commit comments