[Mono-bugs] [Bug 52643][Wis] New - XslTransform.Transform call fails with "Unhandled Exception: System.OutOfMemoryException" when nothing is returned from the transformation
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 6 Jan 2004 17:07:03 -0500 (EST)
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 wmavis@thinktmr.com.
http://bugzilla.ximian.com/show_bug.cgi?id=52643
--- shadow/52643 2004-01-06 17:07:02.000000000 -0500
+++ shadow/52643.tmp.28747 2004-01-06 17:07:02.000000000 -0500
@@ -0,0 +1,146 @@
+Bug#: 52643
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: System.XML
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: wmavis@thinktmr.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: XslTransform.Transform call fails with "Unhandled Exception: System.OutOfMemoryException" when nothing is returned from the transformation
+
+Description of Problem:
+When a Transformation does not return anything, the Transformation call
+fails with:
+
+(Transform.exe:32481): GLib-CRITICAL **: file gutf8.c: line 1335
+(g_utf8_to_utf16): assertion `str != NULL' failed
+GC Warning: Out of Memory! Returning NIL!
+
+Unhandled Exception: System.OutOfMemoryException: There is insufficient
+memory to continue execution
+
+
+Steps to reproduce the problem:
+1. Compile and run the following code:
+
+using System;
+using System.Xml;
+using System.Xml.Xsl;
+
+class Transform
+{
+ static void Main()
+ {
+ XmlDocument xml;
+ XslTransform goodXsl;
+ XslTransform badXsl;
+
+ Console.WriteLine("Setup our XSL");
+ xml = new XmlDocument();
+ xml.LoadXml(
+ "<?xml version=\"1.0\" ?>" +
+ "<xsl:stylesheet
+xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">" +
+ " <xsl:output method=\"text\" />" +
+ " <xsl:template match=\"/\">This
+version works\n</xsl:template>" +
+ "</xsl:stylesheet>"
+ );
+
+ goodXsl = new XslTransform();
+ goodXsl.Load(xml, null, null);
+
+ xml.LoadXml(
+ "<?xml version=\"1.0\" ?>" +
+ "<xsl:stylesheet
+xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">" +
+ " <xsl:output method=\"text\" />" +
+ " <xsl:template
+match=\"/\"></xsl:template>" +
+ "</xsl:stylesheet>"
+ );
+
+ badXsl = new XslTransform();
+ badXsl.Load(xml, null, null);
+
+ Console.WriteLine("Setup our XML");
+ xml.LoadXml("<NeedSomething />");
+
+ Console.WriteLine("Good Transform: ");
+ goodXsl.Transform(xml, null, Console.Out);
+ Console.WriteLine("Done");
+
+ Console.WriteLine("Bad Transform: ");
+ badXsl.Transform(xml, null, Console.Out);
+ Console.WriteLine("Done");
+ }
+}
+
+
+Actual Results:
+mono Transform.exe
+Setup our XSL
+Setup our XML
+Good Transform:
+This version works
+Done
+Bad Transform:
+
+(Transform.exe:32481): GLib-CRITICAL **: file gutf8.c: line 1335
+(g_utf8_to_utf16): assertion `str != NULL' failed
+GC Warning: Out of Memory! Returning NIL!
+
+Unhandled Exception: System.OutOfMemoryException: There is insufficient
+memory to continue execution
+in (unmanaged) /usr/local/lib/libmono.so.0(mono_raise_exception+0x1f)
+[0x4008beff]
+in (unmanaged) /usr/local/lib/libmono.so.0 [0x4008a804]
+in (unmanaged) /usr/local/lib/libmono.so.0(mono_string_new_size+0x94)
+[0x4008b3c4]
+in (unmanaged) /usr/local/lib/libmono.so.0(mono_string_new_utf16+0x2c)
+[0x4008b2ac]
+in (unmanaged) /usr/local/lib/libmono.so.0(mono_string_new_len+0x68)
+[0x4008b468]
+in (unmanaged) /usr/local/lib/libmono.so.0 [0x400a6ac5]
+in <0x0002b> (wrapper managed-to-native)
+System.Runtime.InteropServices.Marshal:PtrToStringAnsi (intptr,int)
+in <0x00081> System.Xml.Xsl.UnmanagedXslTransform:GetStringFromDocument
+(intptr,intptr)
+in <0x000f8>
+System.Xml.Xsl.UnmanagedXslTransform:ApplyStylesheetAndGetString
+(intptr,string[],System.Collections.Hashtable)
+in <0x0046d> System.Xml.Xsl.UnmanagedXslTransform:Transform
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.Xml.XmlWriter,System.Xml.XmlResolver)
+in <0x0004b> System.Xml.Xsl.UnmanagedXslTransform:Transform
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter,System.Xml.XmlResolver)
+in <0x0001a> System.Xml.Xsl.XslTransform:Transform
+(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter,System.Xml.XmlResolver)
+in <0x0003d> System.Xml.Xsl.XslTransform:Transform
+(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter)
+in <0x0016e> .Transform:Main ()
+
+
+Expected Results:
+mono Transform.exe
+Setup our XSL
+Setup our XML
+Good Transform:
+This version works
+Done
+Bad Transform:
+Done
+
+
+How often does this happen?
+ Every time
+
+
+Additional Information: