I'm enjoying using Fluent NHibernate with AutoMappings but every now and then I get this runtime error when trying to create the fluent configuration: 'An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collections, and InnerException for more detail.'
Now this can mean all sorts of things, but the exception details are not very helpful at all. Sometimes the class that NHibernate fails to process will be listed in the InnerException, other times I get mystic messages like this:
{"(XmlDocument)(3,6): XML validation error: The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has invalid child element 'property' in namespace 'urn:nhibernate-mapping-2.2'. List of possible elements expected: 'meta, subselect, cache, synchronize, comment, tuplizer, id, composite-id' in namespace 'urn:nhibernate-mapping-2.2'."}
That doesnt really help me track down the error. Is there any way to get a detailed log of what NHibernate's trying to do (ie, what class/method it's currently auto-mapping) so I can at least identify the part of my code that is causing the problem?
edit:
Known reasons for this error:
- database connectivity (should be visible in InnerException detail)
- missing virtual modifier on properties (should indicate type in InnerException detail)
- missing ID field (gives non specific error as listed above)