Configuration.BuildSessionFactory throws a NullReferenceException when loading an invalid ICompositeUserType

Description

ICompositeUserType exposes properties which could return invalid values (PropertyNames and PropertyTypes), yet they are used without checking if the result is null.

The result is that BuildSessionFactory will throw a NullReferenceException if they are null, instead of an exception indicating the invalid state of the user-authored type.

Repro steps:

1) Create a type which implements ICompositeUserType and return null for PropertyNames and PropertyTypes.
2) Create a domain model where a property is a type using the custom ICompositeUserType created in Step 1.
3) Load the mapping file and call BuildSessionFactory

Expected:
An error describing the problem with the invalid ICompositeUserType

Actual:
A NullReferenceException

Environment

None

Attachments

2

Activity

Show:

Alex Zaytsev 
September 8, 2014 at 11:32 AM

Close issues resolved in 3.3.3

Oskar Berggren 
February 9, 2013 at 1:29 PM

With some hesitation, I've decided to favor being helpful to the application developer. Fixed in ea32bc5bc76e2244c68b9df723bd8a80234ef8ba.

Fabio Maulo 
August 21, 2010 at 5:11 AM

Is supposed that the custom type has its own tests.
You don't need to use NH to test you custom type.
Btw, this is an good improvement.

RoryR 
August 19, 2010 at 4:11 PM

CheckUserTypePropertyTypesForNull.patch fixes the issue.

NH2297.patch provides a test.

RoryR 
August 19, 2010 at 2:47 PM

Test and patch on the way...

Fixed

Details

Assignee

Reporter

Components

Fix versions

Priority

Who's Looking?

Open Who's Looking?
Created August 19, 2010 at 2:41 PM
Updated September 8, 2014 at 11:32 AM
Resolved February 9, 2013 at 1:29 PM
Who's Looking?