File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
src/WireMock.Net.Shared/Util Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -119,13 +119,21 @@ private static bool TryFindTypeInDlls<TInterface>(string? implementationTypeFull
119
119
120
120
private static bool TryGetImplementationTypeByInterfaceAndOptionalFullName < T > ( Assembly assembly , string ? implementationTypeFullName , [ NotNullWhen ( true ) ] out Type ? type )
121
121
{
122
- type = assembly
123
- . GetTypes ( )
124
- . FirstOrDefault ( t =>
125
- typeof ( T ) . IsAssignableFrom ( t ) && ! t . GetTypeInfo ( ) . IsInterface &&
126
- ( implementationTypeFullName == null || string . Equals ( t . FullName , implementationTypeFullName , StringComparison . OrdinalIgnoreCase ) )
127
- ) ;
128
-
129
- return type != null ;
122
+ try
123
+ {
124
+ type = assembly
125
+ . GetTypes ( )
126
+ . FirstOrDefault ( t =>
127
+ typeof ( T ) . IsAssignableFrom ( t ) && ! t . GetTypeInfo ( ) . IsInterface &&
128
+ ( implementationTypeFullName == null || string . Equals ( t . FullName , implementationTypeFullName , StringComparison . OrdinalIgnoreCase ) )
129
+ ) ;
130
+
131
+ return type != null ;
132
+ }
133
+ catch
134
+ {
135
+ type = null ;
136
+ return false ;
137
+ }
130
138
}
131
139
}
You can’t perform that action at this time.
0 commit comments