-
Notifications
You must be signed in to change notification settings - Fork 756
Optimizes implicit assembly loading. Helps to reduce amount of faulted LoadAssembly calls. #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
8ee0c65
d09fc92
4af13a3
c28bafd
f016059
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,6 +196,14 @@ public static Assembly LoadAssembly(string name) | |
Assembly assembly = null; | ||
try | ||
{ | ||
var importEvent = new ImplicitAssemblyLoadingEventArgs(name); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmitriyse why did you augment assembly loading with this event, I cannot see the purpose of this. |
||
if (importEvent.SkipAssemblyLoad) | ||
{ | ||
return null; | ||
} | ||
|
||
PythonEngine.RaiseAssemblyAsModuleImportingEvent(importEvent); | ||
|
||
assembly = Assembly.Load(name); | ||
} | ||
catch (Exception) | ||
|
@@ -419,12 +427,15 @@ public static List<string> GetNames(string nsname) | |
{ | ||
foreach (Assembly a in namespaces[nsname].Keys) | ||
{ | ||
Type[] types = a.GetTypes(); | ||
Type[] types = a.IsDynamic ? a.GetTypes(): a.GetExportedTypes(); | ||
foreach (Type t in types) | ||
{ | ||
if ((t.Namespace ?? "") == nsname) | ||
{ | ||
names.Add(t.Name); | ||
if (!t.IsNested) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @why is this nested check needed? should there be a test for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmitriyse ok, I see this comment in the header of the PR: Type.IsNested types are excluded from the names collection that is used for implicit assembly loading. |
||
{ | ||
names.Add(t.Name); | ||
} | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmitriyse please add reference to this pull request and issues from which you referred to this pull request.