This was a bug in NHibernate. It would try to get the class mapping data for the Enumerable type parameter. When projecting an Enumerable of a mapped class this works perfectly. In this instance, however, the Enumerable type parameter is string. String does not have a class map and so it was substituting a null constant in the query which then caused issues later on.
To further illustrate this, the SQL query for this example would be:
SELECT c.Name, p.Id, p.Name FROM Post p LEFT JOIN Category c ON p.Id = c.PostId WHERE p.Id = 1
This would return data like so:
c.Name | p.Id | p.Name
--------------------------
Cat 1 | 1 | Post A
Cat 2 | 1 | Post A
NHibernate would then, in memory, perform a group by operation, including null checks, to create a list of categories for each unique value of p.Id. The group by operation is performed using column indexes.
That is what should be happening. The bug was causing the results to be transformed, before the group by operation, into:
NULL | Cat 1 | 1 | Post A
NULL | Cat 2 | 1 | Post A
NHibernate was then filtering results where column 0 was null, meaning none of them survive.
The pull request containing the fix is here: https://github.com/nhibernate/nhibernate-core/pull/262