Hey everyone,

I'm not sure where to post this, so I figured this might be the best
place... if I'm wrong, my apologies, and can someone point me in the
right direction?

I am running Nhibernate 3.1 (Fluent on top) in an MVC app. I am using
the NHibernate.Linq library that is now built into NHibernate
(Session.Query<>). Everything runs fine when compiled in Debug mode,
but when I flip over to Release mode, I get ab exception out of it in
my Repository's FindOne() method. Near as I can tell, when I am
calling

    var results = Session.Query<User>.Find().Where(x => x.Email =
email)

NHibernate builds it's query, and then on the next line where I check
if more than one result has been returned (results.Count() > 1), this
fires off the NHibernate query execution, which is where the exception
is being thrown from.

It appears to come from NHibernate.Linq.NhQueryProvider, in the
ExecuteQuery method (line 98), which appears to be returning the first
item in a list as a last resort to a few other things it checks
first... I don't know enough about the internals of NHibernate to
troubleshoot this, or say if it is really a bug or me doing something
that isn't supported.

The kicker though, as I said, is that this only breaks when my app is
compiled in release mode.

Thanks for all the work guys! Hope this contributes something
worthwhile back.

Reply via email to