[Mono-devel-list] XSP

Willibald Krenn Willibald.Krenn at gmx.at
Tue Jan 18 15:25:47 EST 2005


Willibald Krenn schrieb:
> Hi!
> 
> I'm still trying to get the xsp demo running here. After recompiling 
> mono without ICU, the 'Security' problem went away, but therefore I've 
> got another one:
> 
> System.Runtime.Remoting.RemotingException: Configuration file 
> '/usr/etc/mono/1.0/machine.config' could not be loaded: Expected element
> in <0x00158> System.Web.HttpRuntime:OnFirstRequestStart 
> (System.Web.HttpContext)
> in <0x00151> System.Web.HttpRuntime:InternalExecuteRequest 
> (System.Web.HttpWorkerRequest)
> 
> Anyone knows _what_ element is expected?

Solved the problem by changing (just a copy-and paste from the diff, so 
you get the idea) RemotingConfiguration.cs:

Index: class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs
===================================================================
--- class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs 
(revision 39101)
+++ class/corlib/System.Runtime.Remoting/RemotingConfiguration.cs 
(working copy)
@@ -388,12 +388,14 @@
  	internal class RReader : MiniParser.IReader {
  		private string xml; // custom remoting config file
  		private int pos;
+		private int len;

  		public RReader (string filename)
  		{
  			try {
  				StreamReader sr = new StreamReader (filename);
  				xml = sr.ReadToEnd ();
+				len = xml.Length;
  				sr.Close ();
  			}
  			catch {
@@ -403,7 +405,7 @@

  		public int Read () {
  			try {
-				return (int) xml[pos++];
+				return len == pos ? -1 : (int) xml[pos++];
  			}
  			catch {
  				return -1;

I did not investigate, why the exception is not thrown (or thrown too 
late, or..).

I've also done some mods to MiniParser.cs so that the error messages are 
delivering more information. (Such as line-number, col. number and the 
stack contents)

Index: class/corlib/Mono.Xml/MiniParser.cs
===================================================================
--- class/corlib/Mono.Xml/MiniParser.cs	(revision 39101)
+++ class/corlib/Mono.Xml/MiniParser.cs	(working copy)
@@ -262,14 +262,14 @@
  	};

  	protected static string[] errors = {
-		/* 0 */ "Expected element",
-		/* 1 */ "Invalid character in tag",
-		/* 2 */ "No '='",
-		/* 3 */ "Invalid character entity",
-		/* 4 */ "Invalid attr value",
-		/* 5 */ "Empty tag",
-		/* 6 */ "No end tag",
-		/* 7 */ "Bad entity ref"
+		/* 0 */ "Expected element: Line {0}; Col: {1}\n Stack: {2}",
+		/* 1 */ "Invalid character in tag: Line {0}; Col: {1}\n Stack: {2}",
+		/* 2 */ "No '=' : Line {0}; Col: {1}\n Stack: {2}",
+		/* 3 */ "Invalid character entity: Line {0}; Col: {1}\n Stack: {2}",
+		/* 4 */ "Invalid attr value: Line {0}; Col: {1}\n Stack: {2}",
+		/* 5 */ "Empty tag: Line {0}; Col: {1}\n Stack: {2}",
+		/* 6 */ "No end tag: Line {0}; Col: {1}\n Stack: {2}",
+		/* 7 */ "Bad entity ref: Line {0}; Col: {1}\n Stack: {2}"
  	};

  	protected int line;
@@ -363,7 +363,15 @@
  				if (stateCode == 0xFF) {
  					FatalErr("State dispatch error.");
  				} else {
-					FatalErr(errors[stateCode ^ 0x80]);
+					string stackStr = "";
+					if (tagStack.Count > 0) {
+						System.Collections.IEnumerator tagEnum = tagStack.GetEnumerator ();
+						while (tagEnum.MoveNext()) {
+							stackStr = stackStr +"; "+ tagEnum.Current;
+						}
+					} else
+						stackStr = "Empty";
+					FatalErr( String.Format (errors[stateCode ^ 0x80], this.line, 
this.col, stackStr));
  				}
  			}


Willi
P.S.: I had to disable ICU - seems the SuSE 9.0 AMD64 version just 
prevents mono from running correctly...




More information about the Mono-devel-list mailing list