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

Okay, this one made me want to smash my head with a brick.  I’m working along on a web site using C# and ASP.NET 1.1 when I suddenly get this error.  I’m getting a DataTable from a DataSet so it makes sense.

I start by checking the query. Nope, still returns data just fine.  I test and make sure the DataSet isn’t null.  I make sure the table isn’t null.  Nothing seems to be wrong.  So I say, okay, fuck it and I choose a different way of getting my DataTable.  Then suddenly it’s saying assign “” to the value of a string is an array out of bounds exception.

By this time I’m losing my ever loving mind.  Finally I google it up and find that for what ever reason ASP.NET will flag the first line of a method for that exception even though it happens later in the method.

Completely blew my mind. I mean, I had other errors and exceptions come up that pointed to the right line of code.  But not that one.  VERY furstrating.

So, keep an eye out for that one.