| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 088580d commit 5c9f035
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. | |||
| 8 | 8 | ## [unreleased][] | |
| 9 | 9 | ||
| 10 | 10 | ### Added | |
| 11 | + | ||
| 11 | 12 | - Added support for embedding python into dotnet core 2.0 (NetStandard 2.0) | |
| 12 | 13 | - Added new build system (pythonnet.15.sln) based on dotnetcore-sdk/xplat(crossplatform msbuild). | |
| 13 | 14 | Currently there two side-by-side build systems that produces the same output (net40) from the same sources. | |
@@ -46,6 +47,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. | |||
| 46 | 47 | - Fixed errors breaking .NET Remoting on method invoke ([#276][i276]) | |
| 47 | 48 | - Fixed PyObject.GetHashCode ([#676][i676]) | |
| 48 | 49 | - Fix memory leaks due to spurious handle incrementation ([#691][i691]) | |
| 50 | + - Fix spurious assembly loading exceptions from private types ([#703][i703]) | ||
| 49 | 51 | - Fix inheritance of non-abstract base methods ([#755][i755]) | |
| 50 | 52 | ||
| 51 | 53 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ | |||
| 4 | 4 | using System.Collections.Generic; | |
| 5 | 5 | using System.Diagnostics; | |
| 6 | 6 | using System.IO; | |
| 7 | + using System.Linq; | ||
| 7 | 8 | using System.Reflection; | |
| 8 | 9 | using System.Threading; | |
| 9 | 10 | ||
@@ -348,9 +349,7 @@ internal static void ScanAssembly(Assembly assembly) | |||
| 348 | 349 | // A couple of things we want to do here: first, we want to | |
| 349 | 350 | // gather a list of all of the namespaces contributed to by | |
| 350 | 351 | // the assembly. | |
| 351 | - | ||
| 352 | - Type[] types = assembly.GetTypes(); | ||
| 353 | - foreach (Type t in types) | ||
| 352 | + foreach (Type t in GetTypes(assembly)) | ||
| 354 | 353 | { | |
| 355 | 354 | string ns = t.Namespace ?? ""; | |
| 356 | 355 | if (!namespaces.ContainsKey(ns)) | |
@@ -424,10 +423,9 @@ public static List<string> GetNames(string nsname) | |||
| 424 | 423 | { | |
| 425 | 424 | foreach (Assembly a in namespaces[nsname].Keys) | |
| 426 | 425 | { | |
| 427 | - Type[] types = a.GetTypes(); | ||
| 428 | - foreach (Type t in types) | ||
| 426 | + foreach (Type t in GetTypes(a)) | ||
| 429 | 427 | { | |
| 430 | - if ((t.Namespace ?? "") == nsname) | ||
| 428 | + if ((t.Namespace ?? "") == nsname && !t.IsNested) | ||
| 431 | 429 | { | |
| 432 | 430 | names.Add(t.Name); | |
| 433 | 431 | } | |
@@ -466,5 +464,32 @@ public static Type LookupType(string qname) | |||
| 466 | 464 | } | |
| 467 | 465 | return null; | |
| 468 | 466 | } | |
| 467 | + | ||
| 468 | + internal static Type[] GetTypes(Assembly a) | ||
| 469 | + { | ||
| 470 | + if (a.IsDynamic) | ||
| 471 | + { | ||
| 472 | + try | ||
| 473 | + { | ||
| 474 | + return a.GetTypes(); | ||
| 475 | + } | ||
| 476 | + catch (ReflectionTypeLoadException exc) | ||
| 477 | + { | ||
| 478 | + // Return all types that were successfully loaded | ||
| 479 | + return exc.Types.Where(x => x != null).ToArray(); | ||
| 480 | + } | ||
| 481 | + } | ||
| 482 | + else | ||
| 483 | + { | ||
| 484 | + try | ||
| 485 | + { | ||
| 486 | + return a.GetExportedTypes(); | ||
| 487 | + } | ||
| 488 | + catch (FileNotFoundException) | ||
| 489 | + { | ||
| 490 | + return new Type[0]; | ||
| 491 | + } | ||
| 492 | + } | ||
| 493 | + } | ||
| 469 | 494 | } | |
| 470 | - } | ||
| 495 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments