views:

353

answers:

4

I'm using Turbo Explorer 2006 (update 2), and sometimes the IDE crash in a certain unit, specially when I try to use class-completion. The unit (and whole project) are in production and have run fine for years, with daily modifications, it's just the IDE tools that fail.

Usually if this happens, Delphi survives the crash, but some parts of the IDE are defunct (e.g. debug values in tooltips for expressions whose unit is not in the .dpr)

I suspect the parser dies on some specific construct, probably something ifdef'ed, since this unit is an enormous switchboard of systems.

Does sb know specific constructs that kill the IDE? I'd like to fix this so I can use class-completion again.

+1  A: 
Conspicuous Compiler
A: 

I had some problems with a dynamic multidimensional array:

type
  Foo = array of array of Integer;

Code completion and refactoring didn't work, it gave an error about a ; expected somewhere in that declaration, but it compiled just fine.

I fixed it by modifiying the type declaration to this:

type
  Foo = array of TIntegerDynArray; //TIntegerDynArray is declared in Types unit
The_Fox
Yes, have seen that one too. It is a refusal, and not a crash though
Marco van de Voort
A: 
{$ifdef something}
   type myclass = class
{$else]
   type myclass = class(existingclass);
{$endif}

Seems to confuse, but not crash.

Also ifdef in property declarations seems to upset the system.

In D2009,

type myrecord = record someting : set of 0..31; end;

seemed to inhibit completion (it mumbles about SET), but no crash.

update

It is the "set of" construct itself the completion can't handle (while the compiler can)

Marco van de Voort
Maybe one such ifdef confuses the IDE, and many such ifdefs would crash it ?
A: 

The Delphi IDE and (to a lesser extent) compiler are quite fragile. Many non-expected constructs will cause strange problems. So it's not easy to guess off-hand what's the trouble in your case. (The way you describe your unit, I suspect the IFDEF's may play a role though.)

Can't you comment-out parts on the code until the problem disappears, to see whay may causes it ? If your unit is A B C D, try with

(* A B *) C D

and if that causes no error, try

A B (* C D *)

then perhaps

(* A *) B (* C D *)

etc. until only a small unreducible part of your unit remains. Since you're testing the IDE not the compiler, you probably don't need your commented-out unit to compile without error.

I tried. (and I have some experience in reducing code), but I didn't get really clear cut cases. Just the hunches I already described. I suspect that a ifdef in a property declaration caused the crash, but I couldn't get it duplicated in isolation
Marco van de Voort