Nested Components - NullReferenceException when initializing validation infrastructure.
Description
Environment
Attachments
- 25 Mar 2010, 08:31 AM
Activity
Dario Quintana June 28, 2010 at 9:32 AM
Sorry, the real fix is in r1294.
Dario Quintana May 7, 2010 at 9:48 AM
Fixed in r1288
Valeriu Caraulean April 13, 2010 at 10:52 PM
Are you looking at the right patch?
Full fixture:
namespace NHibernate.Validator.Tests.Specifics.NHV91
{
[TestFixture]
public class NestedComponentsFixture : PersistenceTest
{
protected override IList Mappings
{
get { return new[] { "Specifics.NHV91.Model.hbm.xml" }; }
}
protected override void Configure(NHibernate.Cfg.Configuration configuration)
{
var configure = new FluentConfiguration();
configure
.SetDefaultValidatorMode(ValidatorMode.UseExternal)
.IntegrateWithNHibernate
.ApplyingDDLConstraints()
.And
.RegisteringListeners();
var validatorEngine = new ValidatorEngine();
validatorEngine.Configure(configure);
configuration.Initialize(validatorEngine);
}
[Test]
public void Say_Hi()
{
Console.WriteLine("Hi!");
}
}
}
Fabio Maulo April 13, 2010 at 5:20 PM
Where is the conf. of validation ?
I can't find any.
Valeriu Caraulean March 25, 2010 at 8:31 AM
Unit Test that reproduces the problem
After migration to latest NH.Validator (trunk) I'm receiving NREs at initialization stage.
It fails when it tries to process a nested component.
I've found mentions about same scenario & error in other place so it's not a single case.
I've a failing unit test that reproduces the issue. The patch will be attached later.
Stack trace:
--------------------------------------------------- System.NullReferenceException: Object reference not set to an instance of an object.
at NHibernate.Validator.Event.ValidatePreInsertEventListener.SubElementsInspector.AddSubElement(Property property, ValidatableElement element) in ValidatePreInsertEventListener.cs: line 101
at NHibernate.Validator.Event.ValidatePreInsertEventListener.SubElementsInspector.AddSubElement(Property property, ValidatableElement element) in ValidatePreInsertEventListener.cs: line 122
at NHibernate.Validator.Event.ValidatePreInsertEventListener.SubElementsInspector.Inspect(ValidatableElement element) in ValidatePreInsertEventListener.cs: line 86
at NHibernate.Validator.Engine.ValidatorEngine.AddValidator(Type entityType, IValidatableSubElementsInspector inspector) in ValidatorEngine.cs: line 508
at NHibernate.Validator.Event.ValidatePreInsertEventListener.Initialize(Configuration cfg) in ValidatePreInsertEventListener.cs: line 49
at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg, Object[] list)
at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg)
at NHibernate.Cfg.Configuration.GetInitializedEventListeners()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at NHibernate.Validator.Tests.PersistenceTest.BuildSessionFactory() in PersistenceTest.cs: line 170
at NHibernate.Validator.Tests.PersistenceTest.TestFixtureSetUp() in PersistenceTest.cs: line 58
---------------------------------------------------