#1084 In the .NET API, XdmNode.Parent throws InvalidCastException

v9.2
closed
Michael Kay
.NET API (34)
5
2012-10-08
2010-08-09
Michael Kay
No

In the .NET API, retrieving the property XdmNode.Parent throws an InvalidCastException if the node in question has no parent.

The underlying cause is that the method assumes that XdmValue.Wrap(x) will return null when x is null, whereas it actually returns an XdmEmptySequence. There seem to be a number of other calls that make the same assumption, for example XQueryEvaluator.EvaluateSingle(). I am therefore fixing this with a patch that changes the behaviour of XdmValue.Wrap(x) to return null when x is null.

Discussion

  • Michael Kay
    Michael Kay
    2010-08-09

    Fixed in 9.2.1.2