Since NHibernate version 5.2 (commit: 8124cb5) GetKeyOfOwner in CollectionType.cs throws an exception if the property value (in the database) is null.
Exception:
AssertionFailure: Unable to correctly resolve the owner key, property Property for collection SomeChildrenList.
Unresolved value '', key type 'NHibernate.Type.StringType', owner 'Example.SomeEntity'
Mapping (Example.SomeEntity):
mapping.HasMany(m => m.SomeChildrenList)
.PropertyRef("Property") // Type: String, can be null
.KeyColumns.Add("ReferencedProperty")
.NotFound.Ignore();
There is no ForeignKeyConstraint on Property and ReferencedProperty and both properties are not keys.