Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the location of a "List index out of bounds" error in Delphi

In Delphi 2009, my program now produces a "List index out of bounds" error. It generates a popup box:

alt text
(source: beholdgenealogy.com)

I'm using the "Debug" Build Configuration that has all the Runtime error checking turned on. But this does not capture the error before it happens.

Is there any simple way to locate the source of this error in my program without having to put in breakpoints and narrow it down by trial and error?

like image 263
lkessler Avatar asked Jul 28 '09 02:07

lkessler


2 Answers

Do you have "Stop on Delphi Exceptions" turned on? (Tools\Debugger Options\Language Exceptions [Delphi7]) Otherwise it won't break in your sourcecode.

Also make sure that EListError is not in your "Exception Types to Ignore" list. This list is also found at Tools\Debugger Options\Language Exceptions (Delphi 7).

like image 98
The_Fox Avatar answered Sep 27 '22 02:09

The_Fox


madExcept (free) or EurekaLog (paid) may help. You can set them up to show/email a stack trace when an error occurs. I use EurekaLog in all my projects and it is invaluable for fixing these kinds of things.

like image 37
SeanX Avatar answered Sep 26 '22 02:09

SeanX