Răsfoiți Sursa

2003-03-24 Gonzalo Paniagua Javier <[email protected]>

	* System.Web/HtmlizedException.cs:
	* System.Web/HttpException.cs:
	* System.Web.Compilation/CompilationException.cs:
	* System.Web.Compilation/ParseException.cs: display the correct line
	number in error messages.

	* System.Web.Compilation/AspElements.cs: added TargetSchema attribute
	for control. It's ignored.

svn path=/trunk/mcs/; revision=12782
Gonzalo Paniagua Javier 23 ani în urmă
părinte
comite
0bd263fbfb

+ 1 - 1
mcs/class/System.Web/System.Web.Compilation/AspElements.cs

@@ -377,7 +377,7 @@ namespace System.Web.Compilation
 		private static string [] control_atts = { "AutoEventWireup", "ClassName", "CompilerOptions",
 							  "Debug", "Description", "EnableViewState",
 							  "Explicit", "Inherits", "Language", "Strict", "Src",
-							  "WarningLevel", "CodeBehind" };
+							  "WarningLevel", "CodeBehind", "TargetSchema" };
 
 		private static string [] import_atts = { "namespace" };
 		private static string [] implements_atts = { "interface" };

+ 8 - 0
mcs/class/System.Web/System.Web.Compilation/ChangeLog

@@ -1,3 +1,11 @@
+2003-03-24  Gonzalo Paniagua Javier <[email protected]>
+
+	* CompilationException.cs:
+	* ParseException.cs: display the correct line number in error messages.
+
+	* AspElements.cs: added TargetSchema attribute for control. It's
+	ignored.
+
 2003-03-17  Gonzalo Paniagua Javier <[email protected]>
 
 	* BaseCompiler.cs: fixed the hack to work under windows.

+ 1 - 1
mcs/class/System.Web/System.Web.Compilation/CompilationException.cs

@@ -58,7 +58,7 @@ namespace System.Web.Compilation
 
 		//TODO: get lines from compiler output.
 		public override StringReader SourceError { get {return null;}}
-		public override int SourceErrorLine { get { return 0; } }
+		public override int SourceErrorLine { get { return -1; } }
 
 		public override TextReader SourceFile {
 			get {

+ 4 - 3
mcs/class/System.Web/System.Web.Compilation/ParseException.cs

@@ -25,7 +25,7 @@ namespace System.Web.Compilation
 		{
 			this.fileName = fileName;
 			this.message = message;
-			this.line = line;
+			this.line = line >= 1 ? line : 1;
 			this.col = col;
 		}
 		
@@ -34,9 +34,10 @@ namespace System.Web.Compilation
 		{
 			this.fileName = fileName;
 			this.message = message;
-			this.line = line;
+			this.line = line >= 1 ? line : 1;
 			this.col = col;
 		}
+
 		public override string Title {
 			get { return "Parser Error"; }
 		}
@@ -59,7 +60,7 @@ namespace System.Web.Compilation
 		public override StringReader SourceError {
 			get {
 				StreamReader input = new StreamReader (File.OpenRead (fileName));
-				string result = GetErrorLines (input, line, out sourceErrorLine);
+				string result = GetErrorLines (input, line - 1, out sourceErrorLine);
 				input.Close ();
 				input = null;
 				return new StringReader (result);

+ 5 - 0
mcs/class/System.Web/System.Web/ChangeLog

@@ -1,3 +1,8 @@
+2003-03-24  Gonzalo Paniagua Javier <[email protected]>
+
+	* HtmlizedException.cs:
+	* HttpException.cs: display the correct line number in error messages.
+
 2003-03-22  Gonzalo Paniagua Javier <[email protected]>
 
 	* HttpCachePolicy.cs: implemented all TODOs.

+ 1 - 1
mcs/class/System.Web/System.Web/HtmlizedException.cs

@@ -48,7 +48,7 @@ namespace System.Web
 		internal static string GetErrorLines (TextReader reader, int line, out int errorLine)
 		{
 			int firstLine = (line > 2) ? (line - 2) : line;
-			int lastLine = (line > 0) ? (firstLine + 2) : Int32.MaxValue;
+			int lastLine = (line >= 0) ? (firstLine + 2) : Int32.MaxValue;
 			errorLine = (line > 2) ? line : 1;
 			int current = 0;
 			string s;

+ 11 - 1
mcs/class/System.Web/System.Web/HttpException.cs

@@ -126,7 +126,11 @@ namespace System.Web
 				builder.Append ("</td></tr>\n</table>\n<p>\n");
 			}
 
-			builder.AppendFormat ("<b>Source File: </b>{0}\n<p>\n", exc.FileName);
+			builder.AppendFormat ("<b>Source File: </b>{0}", exc.FileName);
+			if (exc.SourceErrorLine != -1)
+				builder.AppendFormat ("&nbsp;&nbsp;&nbsp;&nbsp;<b>Line:</b>{0}", exc.SourceErrorLine);
+
+			builder.Append ("\n<p>\n");
 
 			if (exc.HaveSourceFile) {
 				builder.Append ("<table summary=\"Source file\" width=\"100%\" bgcolor=\"#ffffc\">\n<tr><td>");
@@ -151,10 +155,16 @@ namespace System.Web
 			string s;
 			builder.Append ("<code><pre>\n");
 			while ((s = reader.ReadLine ()) != null) {
+				if (current == errorLine)
+					builder.Append ("<span style=\"color: red\">");
+
 				if (lines)
 					builder.AppendFormat ("Line {0}: {1}\n", current++, HtmlEncode (s));
 				else
 					builder.AppendFormat ("{1}\n", current++, HtmlEncode (s));
+
+				if (current == errorLine + 1)
+					builder.Append ("</span>");
 			}
 
 			builder.Append ("</pre></code>\n");