Accessing the Parent property of an XdmNode object can throw an InvalidCastException when there is no parent. Saxon somehow returns an XdmEmptySequence instead of null, which cannot be converted to XdmNode. This forces anyone using this property to have a try catch block when they should only need a simple null check.
System.InvalidCastException: Unable to cast object of type 'Saxon.Api.XdmEmptySequence' to type 'Saxon.Api.XdmNode'. at Saxon.Api.XdmNode.get_Parent()