Report compilation errors when the type named in 'class' can't be loaded.
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 14 Sep 2011 00:18:30 +0000 (20:18 -0400)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 14 Sep 2011 00:19:24 +0000 (20:19 -0400)
mcs/class/System.Web/System.Web.Compilation/GenericBuildProvider.cs

index a13a768d621793defe4c0d10a2d2366e336fded0..be6c55b879d1438f9064a56710aad73c65bceb4f 100644 (file)
@@ -146,13 +146,17 @@ namespace System.Web.Compilation
                        if (NeedsLoadFromBin && _compiler != null)
                                return LoadTypeFromBin (_compiler, Parser);
                        
+                       Type type = null;
                        // This is not called if compilation failed.
                        // Returning null makes the caller throw an InvalidCastException
                        Assembly assembly = results != null ? results.CompiledAssembly : null;
-                       if (assembly == null)
-                               return null;
-                       
-                       return assembly.GetType (GetClassType (_compiler, Parser));
+                       if (assembly != null) {
+                               type = assembly.GetType (GetClassType (_compiler, Parser));
+                       }
+                       if (type == null) {
+                               throw new HttpException (500, String.Format ("Type {0} could not be loaded", GetClassType (_compiler, Parser)));
+                       }
+                       return type;
                }
 
                // This is intended to be used by builders which may need to do special processing