File tree Expand file tree Collapse file tree 2 files changed +28
-15
lines changed Expand file tree Collapse file tree 2 files changed +28
-15
lines changed Original file line number Diff line number Diff line change @@ -12,22 +12,35 @@ internal static class ExceptionExtensions
1212 /// </summary>
1313 /// <param name="exception">The exception to check.</param>
1414 /// <returns></returns>
15- public static bool IsFatal ( this Exception exception )
15+ public static bool IsFatal ( this Exception ? exception )
1616 {
17- Throw . IfNull ( exception ) ;
18- while ( exception != null )
17+ while ( exception is not null )
1918 {
2019 if ( exception
2120 is ( OutOfMemoryException and not InsufficientMemoryException )
22- or ThreadAbortException
23- or AccessViolationException
24- or SEHException
25- or StackOverflowException )
21+ or AppDomainUnloadedException
22+ or BadImageFormatException
23+ or CannotUnloadAppDomainException
24+ or InvalidProgramException
25+ or AccessViolationException )
2626 {
2727 return true ;
2828 }
2929
30- exception = exception . InnerException ;
30+ if ( exception is AggregateException aggregate )
31+ {
32+ foreach ( Exception inner in aggregate . InnerExceptions )
33+ {
34+ if ( inner . IsFatal ( ) )
35+ {
36+ return true ;
37+ }
38+ }
39+ }
40+ else
41+ {
42+ exception = exception . InnerException ;
43+ }
3144 }
3245
3346 return false ;
Original file line number Diff line number Diff line change @@ -11,18 +11,18 @@ public class FunctionsAssemblyResolver : DefaultAssemblyResolver
1111 private static readonly ImmutableHashSet < string > TrustedPlatformAssemblies
1212 = GetTrustedPlatformAssemblies ( ) ;
1313
14- private static ImmutableHashSet < string > GetTrustedPlatformAssemblies ( )
15- {
16- var data = AppContext . GetData ( "TRUSTED_PLATFORM_ASSEMBLIES" ) ;
17- return data . ToString ( ) . Split ( Path . PathSeparator )
18- . ToImmutableHashSet ( StringComparer . OrdinalIgnoreCase ) ;
19- }
20-
2114 public override AssemblyDefinition ? Resolve ( AssemblyNameReference name )
2215 {
2316 // As soon as we get to a TPA we can stop. This helps prevent the odd circular reference
2417 // with type forwarders as well.
2518 AssemblyDefinition assemblyDef = base . Resolve ( name ) ;
2619 return TrustedPlatformAssemblies . Contains ( assemblyDef . MainModule . FileName ) ? null : assemblyDef ;
2720 }
21+
22+ private static ImmutableHashSet < string > GetTrustedPlatformAssemblies ( )
23+ {
24+ object data = AppContext . GetData ( "TRUSTED_PLATFORM_ASSEMBLIES" ) ;
25+ return data is null ? [ ] : data . ToString ( ) . Split ( Path . PathSeparator )
26+ . ToImmutableHashSet ( StringComparer . OrdinalIgnoreCase ) ;
27+ }
2828}
You can’t perform that action at this time.
0 commit comments