File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -414,6 +414,10 @@ internal static Type[] GetTypes(Assembly a)
414
414
catch ( ReflectionTypeLoadException exc )
415
415
{
416
416
// Return all types that were successfully loaded
417
+ foreach ( var item in exc . LoaderExceptions )
418
+ {
419
+ System . Console . Error . WriteLine ( "[pythonnet] {0}" , item . Message ) ;
420
+ }
417
421
return exc . Types . Where ( x => x != null && IsExported ( x ) ) . ToArray ( ) ;
418
422
}
419
423
}
@@ -425,8 +429,31 @@ internal static Type[] GetTypes(Assembly a)
425
429
}
426
430
catch ( FileNotFoundException )
427
431
{
432
+ System . Console . Error . WriteLine ( "[pythonnet] {0} File not found" , a . GetName ( ) ) ;
433
+ return new Type [ 0 ] ;
434
+ }
435
+ catch ( System . TypeLoadException e )
436
+ {
437
+ try
438
+ {
439
+ return a . GetTypes ( ) . Where ( IsExported ) . ToArray ( ) ;
440
+ }
441
+ catch ( ReflectionTypeLoadException exc )
442
+ {
443
+ foreach ( var item in exc . LoaderExceptions )
444
+ {
445
+ System . Console . Error . WriteLine ( "[pythonnet] {0}" , item . Message ) ;
446
+ }
447
+ // Return all types that were successfully loaded
448
+ return exc . Types . Where ( x => x != null && IsExported ( x ) ) . ToArray ( ) ;
449
+ }
450
+ }
451
+ catch ( Exception e ) // System.TypeLoadException
452
+ {
453
+ System . Console . Error . WriteLine ( "[pythonnet] {0} {1}" , a . GetName ( ) , e ) ;
428
454
return new Type [ 0 ] ;
429
455
}
456
+
430
457
}
431
458
}
432
459
You can’t perform that action at this time.
0 commit comments