Sunday, October 4, 2009

NHibernate error ‘Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index’

I got the following NHibernate error when I tried to commit an entity class using a transaction:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
I figured out that two fields in the .hbm.xml mapping file reference the same column in a table. Simple bug, but complicated to debug.