System.NullReferenceException: Object reference not set to an instance of an object
at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindClass (System.Xml.XmlNode node, IDecoratable classMapping, NHibernate.Mapping.PersistentClass model, IDictionary`2 inheritedMetas) [0x00000] in :0
at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind (System.Xml.XmlNode node, NHibernate.Cfg.MappingSchema.HbmClass classSchema, IDictionary`2 inheritedMetas) [0x00000] in :0
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses (System.Xml.XmlNode parentNode, IDictionary`2 inheritedMetas) [0x00000] in :0
at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind (System.Xml.XmlNode node) [0x00000] in :0
at NHibernate.Cfg.Configuration.AddValidatedDocument (NHibernate.Cfg.NamedXmlDocument doc) [0x00000] in :0
I got this stacktrace while trying to get a simple app using NHibernate up and running. I eventually found the solution in this forum post.
12345678910111213141516
// [Class(Table="Task")] - This was the problem.[Class(Name="Project.Models.Task, Project", Table="Task")]publicclassTask{ [Id(Name="Id")] [Generator(1, Class="native")]publicvirtualstringId{get;set;} [Property]publicvirtualstringDescription{get;set;} [Property]publicvirtualboolComplete{get;set;} [Property]publicvirtualDateTimeCreatedAt{get;set;} [Property]publicvirtualDateTimeUpdatedAt{get;set;}}
I needed to add the FQDN of the class and the assembly name. In the example above, replace Project with your assembly name.