[Mono-list] Different behavior when calling XPathSelectElement on a null XElement between Mono 3.10 and .NET/MS-CLR 4.5

d_k mail4dk at gmail.com
Fri Oct 10 16:32:35 UTC 2014


Hello,

I'm not sure how to call the none Mono CLR so i'll call it .NET 4.5.

I'm not sure how much of an issue is it really but I noticed that the
following code produces different results for me in Mono and in .NET:

Console.WriteLine("Start");
XElement element = null;
XElement result = element.XPathSelectElement("missing");
if (result != null)
{
    Console.WriteLine(result.Value);
}
Console.WriteLine("End.");

In .NET 4.5 this produces a System.ArgumentNullException as the argument
passed to the extension method XPathSelectElement is null.

In Mono 3.10 the call to XPathSelectElement returns null which then
continues execution and as a result code that runs fine on Mono throws on
Windows/.NET 4.5

If it helps I'm running Mono version 3.10.0 compiled from source on
slaware-current x86_64.

Is it really an issue or is so by design?
Should I open a bug for it and if so what should I include or is this
discrepancy should be tolerated?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20141010/b9b8f1fd/attachment.html>


More information about the Mono-list mailing list