[Mono-bugs] [Bug 61685][Blo] New - msxsl:script is broken (missing Microsoft.JScript.dll?)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 16 Jul 2004 20:42:34 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by msolnit@istante.com.

http://bugzilla.ximian.com/show_bug.cgi?id=61685

--- shadow/61685	2004-07-16 20:42:34.000000000 -0400
+++ shadow/61685.tmp.5203	2004-07-16 20:42:34.000000000 -0400
@@ -0,0 +1,168 @@
+Bug#: 61685
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: msolnit@istante.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: msxsl:script is broken (missing Microsoft.JScript.dll?)
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+I am trying to use an XSLT stylesheet which contains an "mxsxsl:script" 
+element.  Because this loads the Microsoft.JScript runtime, it fails on 
+my system where the Microsoft.JScript.dll assembly is not found.
+
+I installed all the packages from Red Carpet, including mono-complete and 
+mono-complete-development.  I did not see the file Microsoft.JScript.dll 
+anywhere in /usr/lib/mono/1.0 or /usr/lib/mono/gac.  In fact, a search 
+for Microsoft.JScript.dll across the entire system reveals nothing found.
+
+I tried instead to make the Microsoft.JScript source included with mcs-
+1.0, using configure --prefix=/usr and make.  This produced an assembly, 
+but when I installed it using gacutil -i and then created a symbolic link 
+in /usr/lib/mono/1.0 (it looks like all the other GAC assemblies have 
+symlinks there), the ASP.NET runtime was still unable to find it.
+
+Steps to reproduce the problem:
+1.
+I tried this in an ASP.NET application but have not yet tried it in a 
+console application:
+
+System.Xml.Xsl.XslTransform oTransform = new System.Xml.Xsl.Transform();
+oTransform.Load("ErrorDisplay.xsl");
+
+ErrorDisplay.xsl includes the following XSL:
+
+  <msxsl:script implements-prefix="local"><![CDATA[
+    //********************************************************************
+*****      
+    // IsLongText
+    //
+    // DESCRIPTION:
+    //  Returns true if the given attribute is greater than 100 characters
+		//
+		// RETURNS:
+		//	true or false
+		//
+    //********************************************************************
+*****
+		function IsLongText(attr)
+		{			
+			if (attr.MoveNext())
+			{
+				var strValue = attr.Current.Value.ToString
+();
+				if (strValue.Length > 200)
+					return true;
+			}			
+			return false;
+		}
+
+  ]]></msxsl:script>
+
+2. 
+When viewing the ASP.NET page, I see the following exception:
+Server error in '/demo' application
+
+--------------------------------------------------------------------------
+------
+
+Description: Error processing request. 
+Error Message: HTTP 500. 
+
+Stack Trace: System.ArgumentNullException: Argument cannot be null.
+Parameter name: type
+in <0x00045> System.Activator:CreateInstance (System.Type,bool)
+in <0x00010> System.Activator:CreateInstance (System.Type)
+in <0x00011> Mono.Xml.Xsl.JScriptCompilerInfo:get_CodeDomProvider ()
+in <0x00075> Mono.Xml.Xsl.ScriptCompilerInfo:GetScriptClass 
+(string,string,System.Xml.XPath.XPathNavigator,System.Security.Policy.Evid
+ence)
+in <0x00119> MSXslScript:Compile ()
+in <0x00146> Mono.Xml.Xsl.MSXslScriptManager:AddScript 
+(Mono.Xml.Xsl.Compiler)
+in <0x0049b> Mono.Xml.Xsl.XslStylesheet:HandleTopLevelElement ()
+in <0x00068> Mono.Xml.Xsl.XslStylesheet:ProcessTopLevelElements ()
+in <0x00675> Mono.Xml.Xsl.XslStylesheet:.ctor (Mono.Xml.Xsl.Compiler)
+in <0x0020a> Mono.Xml.Xsl.Compiler:Compile 
+(System.Xml.XPath.XPathNavigator,System.Xml.XmlResolver,System.Security.Po
+licy.Evidence)
+in <0x00044> System.Xml.Xsl.ManagedXslTransform:Load 
+(System.Xml.XPath.XPathNavigator,System.Xml.XmlResolver,System.Security.Po
+licy.Evidence)
+in <0x00054> System.Xml.Xsl.XslTransformImpl:Load 
+(string,System.Xml.XmlResolver)
+in <0x00014> System.Xml.Xsl.XslTransform:Load 
+(string,System.Xml.XmlResolver)
+in <0x00016> System.Xml.Xsl.XslTransform:Load (string)
+in <0x000d1> ASP.StartPage_aspx:__RenderTree 
+(System.Web.UI.HtmlTextWriter,System.Web.UI.Control)
+in <0x00069> (wrapper delegate-invoke) 
+System.MulticastDelegate:invoke_void_HtmlTextWriter_Control 
+(System.Web.UI.HtmlTextWriter,System.Web.UI.Control)
+in <0x00048> System.Web.UI.Control:RenderChildren 
+(System.Web.UI.HtmlTextWriter)
+in <0x00011> System.Web.UI.Control:Render (System.Web.UI.HtmlTextWriter)
+in <0x0001c> System.Web.UI.Control:RenderControl 
+(System.Web.UI.HtmlTextWriter)
+in <0x00429> System.Web.UI.Page:InternalProcessRequest ()
+in <0x000c2> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext)
+in <0x002f3> ExecuteHandlerState:Execute ()
+in <0x00084> StateMachine:ExecuteState 
+(System.Web.HttpApplication/IStateHandler,bool&)
+
+ 
+
+
+
+--------------------------------------------------------------------------
+------
+
+3. 
+Looking in the source code I can see that it tries to load 
+Microsoft.JScript.dll.  This assembly is not there and so the code fails.
+
+/class/System.XML/Mono.Xml.Xsl/MSXslScriptManager.cs (lines 76-77):
+class MSXslScript {
+  ScriptingLanguage language = ScriptingLanguage.JScript; // default = 
+JScript.
+
+/class/System.XML/Mono.Xml.Xsl/JScriptCompilerInfo.cs (lines 219-223):
+static JScriptCompilerInfo ()
+{
+  Assembly jsasm = Assembly.LoadWithPartialName ("Microsoft.JScript", 
+null);
+  providerType = jsasm.GetType ("Microsoft.JScript.JScriptCodeProvider");
+}
+...
+(lines 234-236):
+public override CodeDomProvider CodeDomProvider {
+  get { return (CodeDomProvider) Activator.CreateInstance 
+(providerType); }
+}
+
+
+Since the assembly Microsoft.JScript.dll is not present the call to 
+Activator.CreateInstance() will eventually fail.
+
+Actual Results:
+Exception (see above)
+
+Expected Results:
+Loads the transform successfully.
+
+How often does this happen? 
+Every time.
+
+Additional Information: