|
-
Nov 5th, 2025, 05:53 PM
#1
Thread Starter
Addicted Member
Error I simply don't understand
I am having a program bug that makes absolutely no sense to me.
First issue: The program runs fine most of the time (it is a desktop gadget-type program that updates itself every few hours). However, this is the second time (over the past months) that it threw an error.
Second issue: When I shut the program down and restart it, I get the same error. However, when I open it in Visual Studio and run it, no error.
Here is the error:
Index was outside the bounds of the array.
at xxx.vb: Line1
at xxx.vb: Line2
at xxx.vb: Line3
But this makes no sense at all:
Line1: Dim currentMonth As Integer = DateTime.Now.Month (this line of code is in SubOne)
Line 2: Dim myDocFor As New XDocument (this line of code is in SubTwo, but SubOne is called three lines after this)
Line 3: SubTwo()
What the heck is going on???
Note: Typing this up took about ten minutes and the program is again running properly. In case it matters, it is about 5:00 pm local time.
-
Nov 5th, 2025, 10:07 PM
#2
Re: Error I simply don't understand
Show us the actual code and the actual stack trace for the exception. No pictures though please. Copy the information from VS or the app and paste it as text, formatted appropriately. The exception make sense but you need to look at the actual information provided to see what it is. The stack trace will tell you exactly where the exception was thrown and the path of execution to get there. The first order of business is to determine what array the error message is referring to. You then need to determine what the upper bound of that array is and what index is actually being used. Once you've done that, it will be obvious that the index is greater than the upper bound of the array. You then have to determine where that index came from and why it's incorrect. Note that the line that actually throws the exception may not be in your code. It may be in a first- or third-party method you're calling. The data causing the exception is likely coming from your code though.
-
Nov 5th, 2025, 10:45 PM
#3
Thread Starter
Addicted Member
Re: Error I simply don't understand
Thanks. As indicated, this issue happens infrequently and I need to figure out how to get a stack trace. But, you have provided me with some ideas of how to learn more.
-
Nov 6th, 2025, 09:19 AM
#4
Re: Error I simply don't understand
You could probably open the Windows Event Viewer, expand Windows Logs, and select Application. From there you can do a search for your application name and get the exception message from the details.
-
Nov 6th, 2025, 10:47 AM
#5
Thread Starter
Addicted Member
Re: Error I simply don't understand
Thanks for the suggestion: I did as you indicated, but found nothing from my app (and I checked all five log categories at around the time of the issue).
-
Nov 6th, 2025, 11:14 AM
#6
Re: Error I simply don't understand
That's kind of odd. I would have expected unhandled exceptions to wind up in the event viewer, but that's not always the case.
The only thing I could recommend at this point is to copy/paste the relevant code like JMcIlhinney suggested.
-
Nov 6th, 2025, 10:25 PM
#7
Re: Error I simply don't understand
What it means is that at the time you tried to access an array or collection, that an index you’re trying to access doesn’t exist.
We need to see your code.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Nov 11th, 2025, 05:25 PM
#8
Thread Starter
Addicted Member
Re: Error I simply don't understand
What's truly baffling me is this: The error just occurred again. So, I shutdown the program, reran it, and the error occurred again. So, I opened the program in VS, ran it from within VS, and no error. This makes tracking things down really tough.
Also, the error only seems to happened at about this time of day.
-
Nov 11th, 2025, 05:28 PM
#9
Thread Starter
Addicted Member
Re: Error I simply don't understand
I may have just found the bug - silly mistake because I forgot that arrays are zero based.
-
Nov 11th, 2025, 05:45 PM
#10
Re: Error I simply don't understand
 Originally Posted by groston
I may have just found the bug - silly mistake because I forgot that arrays are zero based.
That'd do it
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Nov 11th, 2025, 06:05 PM
#11
Re: Error I simply don't understand
Just be sure to mark the thread as resolved. You can do this by selecting: Thread Tools > Mark Thread Resolved
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|