[Mono-bugs] [Bug 498389] New: XPathResultType.Number is more strict in Mono than in .NET

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 27 06:30:08 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=498389


           Summary: XPathResultType.Number is more strict in Mono than in
                    .NET
    Classification: Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: 32bit
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: ashmind at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner


Description of Problem:

Steps to reproduce the problem:
1. Create a CustomXsltContext class inheriting from System.Xml.Xsl.XsltContext.
2. Create a CustomXsltFunction class inheriting from
System.Xml.Xsl.IXsltContextFunction.
3. In CustomXsltFunction.ReturnType return a XPathResultType.Number.
4. In CustomXsltFunction.Invoke return 0 (int value).
4. In CustomXsltContext override ResolveFunction to return CustomXsltFunction
when name is "custom-function".
5. Create a new XPath expression:
var xpath = XPathExpression.Compile("custom-function()");
xpath.SetContext(new CustomXsltContext());
6. Call Evaluate(xpath) on any XPathNavigator.

Actual Results:
  System.Xml.XPath.XPathException: Error during evaluation --->
System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Xml.XPath.Expression.EvaluateNumber (System.Xml.XPath.BaseIterator
iter) [0x00000] 
  ...

Expected Results:
Evaluate should return 0 (in Microsoft.NET it does).


How often does this happen? 
Always.

Additional information:
Crashing is correct according to
http://mono-project.com/XPathNavigator#Evaluation_Methods (it says that
XPathResultType.Number corresponds to System.Double not System.Int32).
However, the crash does not happen in .NET, so it seems to be a consistency
bug.

-- 
Configure bugmail: http://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