Permalink
Browse files

Throw inner LoaderException in case of ReflectionTypeLoadException.

  • Loading branch information...
1 parent 8154046 commit 304d52b3403adf41eeb72a42d5b7b0b90fc20560 @krabicezpapundeklu krabicezpapundeklu committed Dec 29, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/NAnt.Core/TypeFactory.cs
@@ -128,7 +128,20 @@ public sealed class TypeFactory {
ExtensionAssembly extensionAssembly = new ExtensionAssembly (
assembly);
- foreach (Type type in assembly.GetTypes()) {
+ Type[] types;
+
+ try {
+ types = assembly.GetTypes();
+ }
+ catch(ReflectionTypeLoadException ex) {
+ if(ex.LoaderExceptions != null && ex.LoaderExceptions.Length > 0) {
+ throw ex.LoaderExceptions[0];
+ }
+
+ throw;
+ }
+
+ foreach (Type type in types) {
//
// each extension type is exclusive, meaning a given type
// cannot be both a task and data type

0 comments on commit 304d52b

Please sign in to comment.