Author: mhabersack
Date: 2007-04-26 16:23:51 -0400 (Thu, 26 Apr 2007)
New Revision: 76352
Modified:
trunk/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
Log:
2007-04-26 Marek Habersack <[EMAIL PROTECTED]>
* AssemblyBuilder.cs: handle compilation failures in a better
way.
Modified: trunk/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
2007-04-26 19:58:52 UTC (rev 76351)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs
2007-04-26 20:23:51 UTC (rev 76352)
@@ -227,12 +227,19 @@
foreach (string refasm in referenced_assemblies)
options.ReferencedAssemblies.Add (refasm);
- results = provider.CompileAssemblyFromFile (options,
files.ToArray ());
+ results = provider.CompileAssemblyFromFile (options,
files.ToArray ());
+
+ if (results.NativeCompilerReturnValue != 0 ||
results.Errors.Count > 0) {
+ string fileText = null;
+ try {
+ using (StreamReader sr = File.OpenText
(results.Errors [0].FileName)) {
+ fileText = sr.ReadToEnd ();
+ }
+ } catch (Exception) {}
+
+ throw new CompilationException (virtualPath,
results.Errors, fileText);
+ }
- // FIXME: generate the code and display it
- if (results.NativeCompilerReturnValue != 0)
- throw new CompilationException (virtualPath,
results.Errors, "");
-
Assembly assembly = results.CompiledAssembly;
if (assembly == null) {
if (!File.Exists (options.OutputAssembly)) {
@@ -241,7 +248,12 @@
"No assembly returned after
compilation!?");
}
- results.CompiledAssembly = Assembly.LoadFrom
(options.OutputAssembly);
+ try {
+ results.CompiledAssembly =
Assembly.LoadFrom (options.OutputAssembly);
+ } catch (Exception ex) {
+ results.TempFiles.Delete ();
+ throw new HttpException ("Unable to
load compiled assembly");
+ }
}
if (!KeepFiles)
Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-04-26
19:58:52 UTC (rev 76351)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-04-26
20:23:51 UTC (rev 76352)
@@ -1,5 +1,8 @@
2007-04-26 Marek Habersack <[EMAIL PROTECTED]>
+ * AssemblyBuilder.cs: handle compilation failures in a better
+ way.
+
* PageCompiler.cs: the Master property must be in the partial
class if present. Fixes bug #81442
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches