File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -203,8 +203,10 @@ public static Assembly LoadAssembly(string name)
203203 }
204204
205205 PythonEngine . RaiseAssemblyAsModuleImportingEvent ( importEvent ) ;
206-
207- assembly = Assembly . Load ( name ) ;
206+ if ( ! importEvent . SkipAssemblyLoad )
207+ {
208+ assembly = Assembly . Load ( name ) ;
209+ }
208210 }
209211 catch ( Exception )
210212 {
@@ -351,8 +353,17 @@ internal static void ScanAssembly(Assembly assembly)
351353 // A couple of things we want to do here: first, we want to
352354 // gather a list of all of the namespaces contributed to by
353355 // the assembly.
356+ Type [ ] types = new Type [ 0 ] ;
357+ try
358+ {
359+ types = assembly . IsDynamic ? assembly . GetTypes ( ) : assembly . GetExportedTypes ( ) ;
360+ }
361+ catch ( TypeLoadException )
362+ {
363+ // Do nothing.
364+ // This problem usually occurs when transitive dependencies have references to older packages than main application.
365+ }
354366
355- Type [ ] types = assembly . GetTypes ( ) ;
356367 foreach ( Type t in types )
357368 {
358369 string ns = t . Namespace ?? "" ;
You can’t perform that action at this time.
0 commit comments