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)
414414 catch ( ReflectionTypeLoadException exc )
415415 {
416416 // 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+ }
417421 return exc . Types . Where ( x => x != null && IsExported ( x ) ) . ToArray ( ) ;
418422 }
419423 }
@@ -425,8 +429,31 @@ internal static Type[] GetTypes(Assembly a)
425429 }
426430 catch ( FileNotFoundException )
427431 {
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 ) ;
428454 return new Type [ 0 ] ;
429455 }
456+
430457 }
431458 }
432459
You can’t perform that action at this time.
0 commit comments