[Mono-bugs] [Bug 401325] New: Cloning an XText throws an ArgumentException.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jun 18 11:23:36 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=401325


           Summary: Cloning an XText throws an ArgumentException.
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: nestor.salceda at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Attached is a little test case (one for NUnit, and other without NUnit) for
reproducing the error.

You can compile with:

$ gmcs -r:System.Xml.Linq -pkg:mono-nunit XmlBug.cs

and you can run with:

$ nunit-console2 XmlBug.exe

or 

$ mono XmlBug.exe

I'm not expecting the ArgumentException, and the output is the following:

1)
Gendarme.Reporter.Test.AddXSLProcessingInstructionActionTest.ProcessExistenceTest
: System.ArgumentException : Value does not fall within the expected range.
  at System.Xml.Linq.XUtil.Clone (System.Object o) [0x000be] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XUtil.cs:115 
  at System.Xml.Linq.XUtil.GetDetachedObject (System.Xml.Linq.XObject child)
[0x00000] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XUtil.cs:93 
  at System.Xml.Linq.XContainer.AddNode (System.Xml.Linq.XNode n) [0x00008] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:81 
  at System.Xml.Linq.XContainer.Add (System.Object content) [0x00033] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:75 
  at System.Xml.Linq.XElement..ctor (System.Xml.Linq.XElement source) [0x00025]
in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs:62 
  at System.Xml.Linq.XUtil.Clone (System.Object o) [0x00034] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XUtil.cs:103 
  at System.Xml.Linq.XUtil.GetDetachedObject (System.Xml.Linq.XObject child)
[0x00000] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XUtil.cs:93 
  at System.Xml.Linq.XContainer.AddNode (System.Xml.Linq.XNode n) [0x00008] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:81 
  at System.Xml.Linq.XContainer.Add (System.Object content) [0x00033] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:75 
  at System.Xml.Linq.XElement..ctor (System.Xml.Linq.XElement source) [0x00025]
in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs:62 
  at System.Xml.Linq.XUtil.Clone (System.Object o) [0x00034] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XUtil.cs:103 
  at System.Xml.Linq.XUtil.GetDetachedObject (System.Xml.Linq.XObject child)
[0x00000] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XUtil.cs:93 
  at System.Xml.Linq.XContainer.AddNode (System.Xml.Linq.XNode n) [0x00008] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:81 
  at System.Xml.Linq.XContainer.Add (System.Object content) [0x00033] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:75 
  at System.Xml.Linq.XElement..ctor (System.Xml.Linq.XElement source) [0x00025]
in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs:62 
  at System.Xml.Linq.XUtil.Clone (System.Object o) [0x00034] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XUtil.cs:103 
  at System.Xml.Linq.XUtil.GetDetachedObject (System.Xml.Linq.XObject child)
[0x00000] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XUtil.cs:93 
  at System.Xml.Linq.XContainer.AddNode (System.Xml.Linq.XNode n) [0x00008] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:81 
  at System.Xml.Linq.XContainer.Add (System.Object content) [0x00033] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:75 
  at System.Xml.Linq.XContainer.Add (System.Object[] content) [0x0001f] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XContainer.cs:97 
  at System.Xml.Linq.XDocument..ctor (System.Xml.Linq.XDeclaration xmldecl,
System.Object[] content) [0x0000d] in
/home/nestor/devel/mono-project/mcs/class/System.Xml.Linq/System.Xml.Linq/XDocument.cs:54 
  at Gendarme.Reporter.AddXSLProcessingInstructionAction.Process
(System.Xml.Linq.XDocument document) [0x00000] 
  at
Gendarme.Reporter.Test.AddXSLProcessingInstructionActionTest.GetProcessedDocument
() [0x00000] 
  at
Gendarme.Reporter.Test.AddXSLProcessingInstructionActionTest.ProcessExistenceTest
() [0x00000] 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00057] in
/home/nestor/devel/mono-project/mcs/class/corlib/System.Reflection/MonoMethod.cs:157 


I believe that the problem is the Clone method doesn't handle the XText type. 
And it should do, because is a XNode subclass.

For more information you can read the following link, but I haven't tested it
in Microsoft .NET:

http://msdn.microsoft.com/en-us/library/bb943882.aspx


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list