Search code examples
delphierror-handlingbounds-checker

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?


Solution

  • 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).