View Issue Details

IDProjectCategoryView StatusLast Update
0020641LazarusIDEpublic2012-07-26 21:23
ReporterBart BroersmaAssigned ToMattias Gaertner 
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionfixed 
Platformi386OSWinMeOS VersionMS
Product Version0.9.31 (SVN)Product Build33269 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0020641: CodeTools fail on inserting eventhadler via doubleclick in OI with error in FindCodeToolForUsed
DescriptionEver so often when I want to create an eventhandler (in OI select event, then double-click) I get a failure from CodeTools:
The messagedialog says there is an error and prompts to look in the messages windwow.
There the message is in the form of "Class TSomeClass not found at Line=SomeValue Col=SomeValue" in PathTo\SomeUnit.pp.

Once this has happend, it becomes impossible to use the OI to create new eventhandlers.
Closing and restarting Lazarus temporarily resolves the issue.

It does not happen al the time, but I cannot determine what makes it happen and what not.

(The problem exists from at least r31810)
Steps To ReproduceOn a form have some component.
In OI select component, select Events Tab, double-click on some event to create a new event-handler.
Additional InformationThis is an excerpt form my lazarus log, the last time this happened.
I just placed an ActionList on a form which also has 1 TButton (which has an OnClick-handler).
I then opened the ActionList-editor and created 2 actions.
After that I selected the actionlist in OI and double-clicked on "OnExecute" and the error occurred.

### TCodeToolManager.HandleException: "Class TFORM1 not found" at Line=1 Col=1 in "F:\LazarusProjecten\u_test.pp"
### TCodeToolManager.HandleException: "Class TFORM1 not found" at Line=1 Col=1 in "F:\LazarusProjecten\u_test.pp"
#################### TOICustomPropertyGrid.DoCallEdit for TStringsPropertyEditor Edit=True
### TCodeToolManager.HandleException: "Class TFORM1 not found" at Line=1 Col=1 in "F:\LazarusProjecten\u_test.pp"
### TCodeToolManager.HandleException: "Class TForm1 not found" at Line=1 Col=1 in "F:\LazarusProjecten\u_test.pp"
#################### TOICustomPropertyGrid.DoCallEdit for TMethodPropertyEditor Edit=True
### TCodeToolManager.HandleException: "Class TForm1 not found" at Line=1 Col=1 in "F:\LazarusProjecten\u_test.pp"
TagsNo tags attached.
Fixed in Revision33465
LazTarget-
Widgetset
Attached Files
  • codetool-error.png (41,350 bytes)
    codetool-error.png (41,350 bytes)
  • codetool-error.txt (829 bytes)
    Hint: Start of reading config file E:\FPC\BIN\I386-WIN32\fpc.cfg
    Hint: End of reading config file E:\FPC\BIN\I386-WIN32\fpc.cfg
    Free Pascal Compiler version 2.6.0 [2011/12/25] for i386
    Copyright (c) 1993-2011 by Florian Klaempfl and others
    Target OS: Win32 for i386
    Compiling test.lpr
    Compiling u_test.pp
    u_test.pp(24,28) Hint: Parameter "Sender" not used
    u_test.pp(25,26) Hint: Parameter "Sender" not used
    u_test.pp(28,22) Hint: Parameter "Sender" not used
    u_test.pp(28,43) Hint: Parameter "Done" not used
    Compiling resource F:\LazarusProjecten\lib\i386-win32\test.or
    Linking test.exe
    84 lines compiled, 12.2 sec , 1221296 bytes code, 306412 bytes data
    6 hint(s) issued
    Project "test" successfully built
    ---------------------------------------------
    E:\Lazarus\lcl\controls.pp(2457,14) Error: unit not found: 
    
    codetool-error.txt (829 bytes)
  • LazFpc-config.zip (52,310 bytes)
  • test-project.zip (2,379 bytes)

Activities

Ludo Brands

2011-11-07 15:04

developer   ~0053891

I'm also getting this frequently. Mostly when creating a new application or re-opening an existing application after having worked quite some time on an app (debugging, etc.). Just had the problem again when creating a new application and double clicking on the form to create the OnCreate event. Message:
\lcl\forms.pp(1706,14) Error: [TFindDeclarationTool.FindCodeToolForUsedUnit] internal error: invalid UnitNameAtom

Console output (recompiled the ide with -WG-):

TDesigner.InvokeComponentEditor A Form1:TForm1
TDesigner.InvokeComponentEditor B TDefaultComponentEditor
TEventsCodeTool.PublishedMethodExists method not found FormCreate
[TEventsCodeTool.CreateMethod] A AMethodName="FormCreate" in "unit1.pas" UseType
InfoForParameters=False
TFindDeclarationTool.FindDeclarationOfPropertyPath unit1.pas PropertyPath="TForm
1.OnCreate"
### TCodeToolManager.HandleException: "[TFindDeclarationTool.FindCodeToolForUsed
Unit] internal error: invalid UnitNameAtom" at Line=1706 Col=14 in "C:\lazarus\l
cl\forms.pp"
TMainIDE.OnPropHookCreateMethod failed adding method to source
TDesigner.InvokeComponentEditor ERROR: Unable to create new method. Please fix t
he error shown in the message window, which is normally below the source editor.

This message is coming back regularly but I have seen others, all pointing to codetools not finding something or detecting a syntax error where there isn't.
Quitting and restarting lazarus is the only way to solve this.
I'm using now trunk 33356 but this happens since several weeks now. XP Sp2.

Actually, in the last 10 minutes I reproduced the problem 3 times but haven't found a reproducible sequence of steps. Running and breaking in a reasonable big app, using code tools (find method declaration, find implementation) are necessary to create the problem.

cobines

2011-11-07 15:48

reporter   ~0053894

I have also had this. In my case choosing rescan FPC sources helped, even though I have not changed any sources.

Mattias Gaertner

2011-11-10 20:52

manager   ~0053987

I fixed the TFindDeclarationTool.FindCodeToolForUsed

Bart Broersma

2012-01-09 12:59

developer   ~0055614

Last edited: 2012-01-09 13:05

This error popped up again (this time by double-click on Button2).
Lazarus 0.9.31 r34638 FPC 2.6.0 i386-win32-win32/win64
I'll attach screenshot and possible relevant files (env. options, current project).

2012-01-09 12:59

 

codetool-error.png (41,350 bytes)
codetool-error.png (41,350 bytes)

2012-01-09 13:04

 

codetool-error.txt (829 bytes)
Hint: Start of reading config file E:\FPC\BIN\I386-WIN32\fpc.cfg
Hint: End of reading config file E:\FPC\BIN\I386-WIN32\fpc.cfg
Free Pascal Compiler version 2.6.0 [2011/12/25] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling test.lpr
Compiling u_test.pp
u_test.pp(24,28) Hint: Parameter "Sender" not used
u_test.pp(25,26) Hint: Parameter "Sender" not used
u_test.pp(28,22) Hint: Parameter "Sender" not used
u_test.pp(28,43) Hint: Parameter "Done" not used
Compiling resource F:\LazarusProjecten\lib\i386-win32\test.or
Linking test.exe
84 lines compiled, 12.2 sec , 1221296 bytes code, 306412 bytes data
6 hint(s) issued
Project "test" successfully built
---------------------------------------------
E:\Lazarus\lcl\controls.pp(2457,14) Error: unit not found: 
codetool-error.txt (829 bytes)

2012-01-09 13:04

 

LazFpc-config.zip (52,310 bytes)

2012-01-09 13:04

 

test-project.zip (2,379 bytes)

Mattias Gaertner

2012-01-09 14:25

manager   ~0055617

I checked all places, where codetools writes 'unit not found'. Either the error is gone or you should now see which unit is missing.

Issue History

Date Modified Username Field Change
2011-11-07 12:08 Bart Broersma New Issue
2011-11-07 12:08 Bart Broersma LazTarget => -
2011-11-07 15:04 Ludo Brands Note Added: 0053891
2011-11-07 15:48 cobines Note Added: 0053894
2011-11-07 16:20 Mattias Gaertner Status new => assigned
2011-11-07 16:20 Mattias Gaertner Assigned To => Mattias Gaertner
2011-11-10 20:52 Mattias Gaertner Fixed in Revision => 33465
2011-11-10 20:52 Mattias Gaertner Note Added: 0053987
2011-11-10 20:52 Mattias Gaertner Status assigned => resolved
2011-11-10 20:52 Mattias Gaertner Resolution open => fixed
2012-01-07 16:40 Bart Broersma Status resolved => closed
2012-01-07 16:40 Bart Broersma Fixed in Version => 0.9.31 (SVN)
2012-01-09 12:59 Bart Broersma Status closed => assigned
2012-01-09 12:59 Bart Broersma Resolution fixed => reopened
2012-01-09 12:59 Bart Broersma Note Added: 0055614
2012-01-09 12:59 Bart Broersma File Added: codetool-error.png
2012-01-09 13:04 Bart Broersma File Added: codetool-error.txt
2012-01-09 13:04 Bart Broersma File Added: LazFpc-config.zip
2012-01-09 13:04 Bart Broersma File Added: test-project.zip
2012-01-09 13:05 Bart Broersma Note Edited: 0055614
2012-01-09 13:21 Mattias Gaertner Summary CodeTools fail on inserting eventhadler via doubleclick in OI => CodeTools fail on inserting eventhadler via doubleclick in OI with error in FindCodeToolForUsed
2012-01-09 14:25 Mattias Gaertner Note Added: 0055617
2012-01-09 14:26 Mattias Gaertner Status assigned => resolved
2012-01-09 14:26 Mattias Gaertner Resolution reopened => fixed
2012-07-26 21:23 Bart Broersma Status resolved => closed