Mar 6 2009
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.
Apr 29, 2009 @ 10:03:42
Thank you so much for this post. I am the architect redesigning a system and implementing jquery and was banging my head against the wall wondering why this was happening, and yet no breakpoints would hit etc.
Saved me a ton of time.
Appreciate the post!
David