When using IResultDocumentHandler with xsl:result-document you get a NullReferenceException if you return a TextWriterDestination as the result of the HandleResultDocument method.
The problem is caused by the fact that the code calls GetResult on the XmlDestination object twice, and with some kinds of XmlDestination, this returns a different object each time; when Close is called in the handler, the result object is then not recognized as one that has previously been returned by the Resolve() method.
A patch is in Subversion. This solves another (theoretical) problem at the same time: it is entirely possible for the HashCode of the result object to change as a result of changes to the content, so use of a Hashtable is not safe. The revised code therefore does a direct search in a list of result objects.