Skip to content

Commit e7edeab

Browse files
author
dse
committed
Assembly loading experience improved + fixes.
1 parent 9304d72 commit e7edeab

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/runtime/assemblymanager.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff 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 ?? "";

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy