none
Index Out of Range Error RRS feed

  • Question

  • Hi Techies, We have a Asp.Net Application which is running in production server. So once it shows the Index Out of range error. we have checked our code that it all are ok. What is the reason for this. Is this the IIS issue or any other reason. Here i am pasting the Screen shot below.

    Please suggest.

    Thank you


    saroj

    Thursday, April 4, 2013 3:11 PM

Answers

All replies

  • Can you show us the callstack when this exception is thrown? Or more detail about the error

    Thursday, April 4, 2013 3:18 PM
  • Hi Farnham, Thank you for your reply. Actually this issue came from our client. So we checked our application. Its running fine. and it is not occurring frequently. Please suggest what might be the reason. If this will repeat in future, then what should be our steps.

    Thank you.


    saroj

    Thursday, April 4, 2013 3:22 PM
  • It is impossible to answer this without more details.  You say that you have checked the code and it is fine....what does that mean? 

    If you know where in the code the error is being thrown for the client, do you check the upper and lower bounds of the data being referenced against the index before trying to get the data?  Do you have the code encapsulated in a try-catch block to trap the error and have the application respond gracefully?

    If it is a client specific environment or data issue, the first thing I would do is try to recreate the issue in a controlled development environment....then you can trace a particular data element or circumstance that causes the error.


    Lawrence L Schaeffer

    Thursday, April 4, 2013 3:26 PM
  • the index out of range is caused when you try to access a member of a collection that doesn't exist.  Rather than just the error message, if you show the callstack as FarnhamSurrey asked then this should show you which collection it is occurring on and then be able to track it down easier.

    andy

    Thursday, April 4, 2013 3:27 PM
  • Well, it is hard to say without any knowledge of the application but I would certainly say the error is in your asp.net code. Since the error is only happening occassionaly, it just means the conditions that cause the problem are rare and subsequently it will be difficult to "see" the error just by looking at the code.

    Can the user say what they were doing on your app when the error occurs? For example, clicking on a row in a grid. Changing a selection in a drop down, or whatever

    Thursday, April 4, 2013 3:33 PM
  • It is impoosible to tell anything without the Callstack!

    You should always log and expose Exceptions with Exception.toString(). Never only log the Exception message!

    http://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET#LogException.ToString%28%29;neverlogonlyException.Message11

    As it happens "irregulary" and only in production enviroment, it could be a concrrency issue. Propably some race condition. But withotu details, we might as well try to guess the next Lottery Numbers.


    Let's talk about MVVM: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b1a8bf14-4acd-4d77-9df8-bdb95b02dbe2

    Thursday, April 4, 2013 6:25 PM