I really hate to bother anyone with this seemingly simple question but it appears I am at the dead end.
I got this message this morning: Index was out of range. Must be .... Parameter name: startIndex.
There are three problem with it. Number one: I have almost debugged this massive application and it seems everything has been working for some time. Unless somehow the input stream's format changed which remains to be checked I do not know where to look.
Second, there is no pointer as to where in the source code it happens.
And thirdly, I checked and rechecked and I swear I do not have any variable of parameter named startIndex in the entire project.
On top of that this error message does not seem to impede the performance. First it appeared twice per run and now only once. It is suggestive of the input stream format change but still I am not certain. If I ignore it the whole app keeps working like nothing happened.
Any suggestions
thanks.

Index was out of range?
Jasbir
Thank you, Ahmed. I am using indexOf() all the time. WIthout it the Substring operation loses any sense.
What other method do you have in mind
Jan Kučera
Dhaval Patel
Hi and thank you for paying attention. I am not sure how to answer your questions, honestly. The environment is: VS2005, C#, Windows App. Debug. There is no exception thrown as far as I can see, because otherwise the execution would have broken down. The debug keeps running. A grey long form (window) appears and I can read this message. There is one (or two, I do not remember clearly) button(s) to close it. Perhaps OK and Cancel.
I cannot reproduce it now because I can run that part only during trading hours on US stock exchanges between 9:30 AM and 4:30 PM EST Mon - Fri.
Perhaps you can suggest how I can force it to throw an exception Then I will know exactly the location for the bug.
Thanks.
nate-d-o-double-g
That was fast. Thank you very much. It gives me some hope. Of course, there is a million substrings in the code but now it might be much easier to find the bug.
SIYER
HowardRichards
Handerson
saradha
It feels to me that you are using a Substring function on a null/empty string. The parameter name being mentioned is the startIndex that is included in Substring.
Hope that helps.
Philly10407
Actually the error disappeared as mysteriously as it appeared. I haven't seen it since Monday morning.
What kind of logging are you talking about It is interesting. There was no exception thrown in the case in question. I do not know why. It could be because I put that block into a try... catch block or something. Sometimes I do it and then forget although there is no need to keep it there since the bug was found elsewhere and removed.
Do you mean that there is a way to set up a system of logging every error for a debug run Where is the file with the error log I think I've used it in he past but now completely forgot where it is, etc.
Answering another question: The input strings are variable length arrays of bytes. The longest is perhaps between 200 and 250 bytes. It is parsed by code provided by the server (a demo). I mutilated that part only to a small extent getting rid of fields I did not need.
I use databases for input as well but this is a real-time data. I get information on the events a fraction of a second after they happened.
The parsing is accompanied by conversion to float, DateTime, char, string, and other types depending on the field's meaning.
Thanks.
Evan Mulawski