It seems today’s the day for me to make daft mistakes and then blog about them.

If you’re using Fluent NHibernate (and there are many reasons why you should ;-)) and see this error message…

An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
  * Database was not configured through Database method.

System.IndexOutOfRangeException: Index was outside the bounds of the array.

at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices)
at System.Array.GetValue(Int32 index)
at NHibernate.Type.AbstractEnumType..ctor(SqlType sqlType, Type enumType)
at NHibernate.Type.EnumStringType..ctor(Type enumClass)
at FluentNHibernate.Mapping.GenericEnumMapper`1..ctor()

Do yourself a favour and check you haven’t left any empty Enums in your domain layer (the one that Fluent NHibernate is using to map to your database).

Funnily enough, if you do have an empty Enum, I don’t know, off the top of my head maybe something like this…

  1. public enum NoteType
  2. {
  3.     
  4. }

Then you’ll probably get the error above.

Stuck every time you jump out of the tutorials?

Make 2019 the year you finally conquer all those controllers, views, models and all that other "stuff" that comes with MVC.

You'll also get ASP.NET advice, guidance and useful tips from me once a week (or so). I respect your email privacy, unsubscribe at any time.

Stuck every time you jump out of the tutorials?

Stop wasting time trying to learn ASP.NET Core MVC and fast forward to the fun bit (building your features)

Can't make sense of front-end development?

Check out Front-end in four hours for a head-start

Take a look

Stuck every time you jump out of the tutorials?

Make 2019 the year you finally conquer all those controllers, views, models and all that other "stuff" that comes with MVC.

You'll also get ASP.NET advice, guidance and useful tips from me once a week (or so). I respect your email privacy, unsubscribe at any time.