Solved

Sudden Error opening Forms in the IDE in Delphi 6 - List Index out of bounds 0)

Posted on 2008-06-09
23
1,437 Views
Last Modified: 2013-11-23
I am having an error when opening \ closing forms in the IDE.  I get a "List index out of bounds (0)" error.  The other developer here is getting the same error.  The error is occuring on some of the forms in our application, but not on all forms.  

The error occurs at run-time as well.  I am not sure how to track down the problem, Any Advice?

Seth
0
Comment
Question by:foremostco
  • 7
  • 6
  • 4
  • +3
23 Comments
 
LVL 13

Expert Comment

by:rfwoolf
ID: 21746680
My humble guess is that some components (usually 3rd party components) are doing this. I would debug by removing any funny components until you no longer see the error.
As another idea, make sure you have the latest version of your Delphi
0
 

Author Comment

by:foremostco
ID: 21746720
We are still maintaining an old version of our system while developing a completely new version.  We have't added or changed any components or code that should have caused this problem, and the forms that are crashing suddenly started crashing on both development machines.  

And ideas on how to find where the error occurs within the form being opened.  It happens in the IDE, and in the running application.  The application does compile.
0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 21746768
So what's changed?
Are you saying 6 months ago you loaded this program into the IDE and everything was fine for all developers?
Now 6 months later you load the project for the first time - same systems with the same versions of delphi - and you get an error?

...you see either it's a Delphi bug and you should just change versions or update delphi,
or it's a problem with a component and you need to remove and check the components.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:foremostco
ID: 21746802
It worked fine on Friday.  This weekend, we updated our SQL server from 2000 to 2005, but this problem occurs even if we are pointed to our old server.  
0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 21746826
Yeah could have been a bad save by somebody.
I've had 1 bad experience with a component that messed up my form. I think the Dice component in JVCL - I was just trying to see what it did - and that would lock up the whole IDE and I couldn't use the form. I don't exactly recall how I solved the problem but I think I had to go and edit the dfm and the unit and try remove the component from there - but I'm not sure how I did it.
Maybe try load any backups you may have.
Also in my IDE there's this drop-down list that saves the layout of the IDE - sometimes I reset this to "Classic Undocked" - not much help I know but it's worth a shot - resetting the layout of the IDE.
0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 21746847
What if for example your DFM said a certain component should be on your form and the itemindex should be '5' but the component only has 4 items?
What if somehow your project has confused your unit and your dfm?
In this case it would be the IDE's fault not the component's and your only solution is to fix it within the project itself - changing delphi versions or upgrading probably wouldn't help.
So my guess is something got corrupted somewhere.
0
 

Author Comment

by:foremostco
ID: 21746852
I have tried deleting the layout files.  This does let me open the file in the IDE, but any change I attempt, or even closing it gives the same error.  

I am actually seeing the error in the version of my system that was released back in April, and worked until we changed the database.  It also gives me the error against the new live (SQL 2005) and old (SQL 2000) server.
0
 
LVL 28

Accepted Solution

by:
2266180 earned 250 total points
ID: 21746855
I sugest installing madexcept or eurekalog both of which will give you the stack trace of the error and thus telling you where the problem is iwthout wasting further time ;)
0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 21746861
...i wish i knew how to read stack traces and things. I find, if it doesn't take me to the line of source code with the problem, it's pretty much no help at all.
0
 
LVL 4

Assisted Solution

by:tobjectpascal
tobjectpascal earned 250 total points
ID: 21748549
Delphi on an exception will give you a line it errors from however sometimes the problem is further back than that.. When an exception takes place do this

Delphi > View > Debug Windows > Call Stack
or
Alt Ctrl and S

At the bottom of the call stack window is the start of the stack, everytime your program goes somewhere, does something, the function/procedure name gets put in, so all you do is work your way from the top (where the error is) down until you find the component/code at fault

Attached an image showing an example, notice how each procedure that gets called gets thrown onto the stack, well everytime you do a Call, the pointer of execution (EIP) gets thrown onto the stack, the esp/ebp gets updated and on Ret back it pops the value back onto EIP so essentially that's what's taking place and Delphi just takes a note on where it was at the time, all quite clever stuff..

Debug.gif
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 21748575
delete the .dsk file in the .dpr directory helps ?
0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 21748593
tobjectpascal
That's great and I'm sure I've read up on this all before - however for example just now it only says "Process is not accessible" is the only item in the call stack ...
That's why I always just resort to the good 'ol fashioned
  showmessage('1');
x 10,000 times
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 21749109
you can post a madexcept or eurekalog call stack here and we might be able to help you with it.
0
 
LVL 28

Expert Comment

by:2266180
ID: 21749128
rfwoolf: just try using one of the products mentioned above: they giuve proepr stacktrace with source file and line number (where applicable). and in case the error is in teh delphi sources and you really want to see what's there because you just can't figure out why the error is happening, you just recompile with debug dcus and you'll get line numbers for those files as well ;)
here are 2 samples from 2 bugreports generated by madexcept that I found on my hdd. I trust it's easy to read and understand :)
with debug dcus:
 
exception number  : 1
exception class   : EVariantInvalidArgError
exception message : Invalid argument.
 
main thread ($50c):
0045bafc +07c aa.exe Variants   609 +10 HandleConversionException
0045ce28 +430 aa.exe Variants  1349 +75 @VarToInteger
005332bc +114 aa.exe Client     129  +9 TClient.Create
00530fb6 +06e aa.exe Unit1      193  +5 TClientForm.FormCreate
004d2bcd +031 aa.exe Forms     2648  +3 TCustomForm.DoCreate
004d283d +019 aa.exe Forms     2575  +1 TCustomForm.AfterConstruction
00403dcb +007 aa.exe System    9074  +1 @AfterConstruction
004d280a +176 aa.exe Forms     2569 +16 TCustomForm.Create
004dbaa0 +03c aa.exe Forms     6946  +4 TApplication.CreateForm
00539ef7 +02f aa.exe theClient   46  +2 initialization
 
 
--------------------------
without debug dcus:
 
exception number  : 1
exception class   : EVariantTypeCastError
exception message : Could not convert variant of type (Null) into type (String).
 
main thread ($bc0):
004575a3 +06f Project1.exe Variants       VarCastError
0045b302 +0aa Project1.exe Variants       @VarToLStr
004a1c95 +095 Project1.exe Unit1    81 +1 TForm1.ItemClick
00490d4a +0a6 Project1.exe Menus          TMenuItem.Click
00491f2b +02b Project1.exe Menus          TMenu.DispatchPopup
00492c0b +0b7 Project1.exe Menus          TPopupList.WndProc
00492b25 +01d Project1.exe Menus          TPopupList.MainWndProc
004680c8 +014 Project1.exe Classes        StdWndProc
77fb4da3 +010 ntdll.dll                   KiUserCallbackDispatcher
77d74e99 +00a user32.dll                  TrackPopupMenuEx
77d8dffa +014 user32.dll                  TrackPopupMenu
004932e4 +0a8 Project1.exe Menus          TPopupMenu.Popup
0048146a +106 Project1.exe Controls       TControl.WMContextMenu
0048680f +05f Project1.exe Controls       TWinControl.WMContextMenu
004803f4 +188 Project1.exe Controls       TControl.WndProc
0048333f +157 Project1.exe Controls       TWinControl.WndProc
00498185 +421 Project1.exe Forms          TCustomForm.WndProc
00482fbc +02c Project1.exe Controls       TWinControl.MainWndProc
004680c8 +014 Project1.exe Classes        StdWndProc
77d45ca3 +04e user32.dll                  DefWindowProcA
77d45f82 +014 user32.dll                  CallWindowProcA
00483423 +0d7 Project1.exe Controls       TWinControl.DefaultHandler
00499602 +05a Project1.exe Forms          TCustomForm.DefaultHandler
00480a08 +00c Project1.exe Controls       TControl.WMRButtonUp
004803f4 +188 Project1.exe Controls       TControl.WndProc
00483271 +089 Project1.exe Controls       TWinControl.WndProc
00498185 +421 Project1.exe Forms          TCustomForm.WndProc
00482fbc +02c Project1.exe Controls       TWinControl.MainWndProc
004680c8 +014 Project1.exe Classes        StdWndProc
77d44387 +006 user32.dll                  DispatchMessageA
0049e49b +083 Project1.exe Forms          TApplication.ProcessMessage
0049e4ba +00a Project1.exe Forms          TApplication.HandleMessage
0049e6da +096 Project1.exe Forms          TApplication.Run
004a22b3 +03b Project1.exe Project1 18 +3 initialization

Open in new window

0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 21749158
Thanks for the help on debugging guys, sorry to foremostco for slightly hijacking your thread - at least you know people are reading it and this is quite enlightening :)

I am learning something new every several days :)
0
 

Author Comment

by:foremostco
ID: 21866274
We had some code that was referencing a file on our network.  It was reading this file and then using it to reference a list.  The file was removed and this caused a problem.  They was we solved it was to remove the component, and then dynamically create it in our application.  When we were at run-time, we were able to trace into the component's code and find the problem.
0
 
LVL 28

Expert Comment

by:2266180
ID: 21867262
madexcept would show the stacktrace of an exception from:
- the IDE (everything not related to your project)
- runing the applicaiton from the IDE
- running the application outside the IDE

I never used eurekalog so I cannot say if it does all the above, but using madexcept, as I suggested, would have given you the stacktrace of the exception and thus allowing you to fix the problem.

so I do not agree with closing withouat accepting one or more of the experts comments.
0
 
LVL 28

Expert Comment

by:2266180
ID: 21902352
I recommend split:
ciuly {http:21746855} & tobjectpascal {http:21748549}
0
 
LVL 28

Expert Comment

by:2266180
ID: 21902368
hm... the old way of giving short links seems to be changed. the IDs are 21746855 and 21748549
0
 
LVL 28

Expert Comment

by:2266180
ID: 21914965
right :D

thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question