Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions 28 src/runtime/assemblymanager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;

Expand Down Expand Up @@ -57,10 +58,17 @@ internal static void Initialize() {
domain.AssemblyResolve += rhandler;

Assembly[] items = domain.GetAssemblies();
for (int i = 0; i < items.Length; i++) {
Assembly a = items[i];
assemblies.Add(a);
ScanAssembly(a);
foreach (var a in items)
{
try
{
ScanAssembly(a);
assemblies.Add(a);
}
catch (Exception ex)
{
Debug.WriteLine(string.Format("Error scanning assembly {0}. {1}", a, ex));
}
}
}

Expand Down Expand Up @@ -282,25 +290,23 @@ public static bool LoadImplicit(string name, bool warn=true) {
// be valid namespaces (to better match Python import semantics).
//===================================================================

static void ScanAssembly(Assembly assembly) {

static void ScanAssembly(Assembly assembly)
{
// A couple of things we want to do here: first, we want to
// gather a list of all of the namespaces contributed to by
// the assembly.

Type[] types = assembly.GetTypes();
for (int i = 0; i < types.Length; i++) {
Type t = types[i];
foreach (var t in types)
{
string ns = t.Namespace;
if ((ns != null) && (!namespaces.ContainsKey(ns))) {
string[] names = ns.Split('.');
string s = "";
for (int n = 0; n < names.Length; n++) {
s = (n == 0) ? names[0] : s + "." + names[n];
if (!namespaces.ContainsKey(s)) {
namespaces.Add(s,
new Dictionary<Assembly, string>()
);
namespaces.Add(s, new Dictionary<Assembly, string>());
}
}
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.