Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Code Editor    [ Add a report in this area ]  
Report #:  105834   Status: Reported
Breakpoints occur in wrong code editor window
Project:  Delphi Build #:  XE, XE2
Version:    16.4 Submitted By:   Daniel Frimerman
Report Type:  Basic functionality failure Date Reported:  5/23/2012 8:58:15 AM
Severity:    Commonly encountered problem Last Updated: 5/30/2012 4:39:06 AM
Platform:    All versions Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
If Code Editor has 2 different files open of the same name, the breakpoints set in the file that was opened first will be triggered in the file that was opened later. The bug is encountered a lot more frequently if working on project groups with projects with identical unit names, e.g. fMainForm or fMain or frmMain; the steps below show a clear way of reproducing the issue.
Steps to Reproduce:
1) Open TestGroup.
You should have "Form1 - Project2" open in the IDE.
Doubleclick the form to enter FormCreate method where you should see a line:
"ShowMessage('This is Project1');"
Place a breakpoint there.
In Project Manager, expand the other project, "Project2.exe", and double click fMainForm.pas.
Click on the menu: "View | New Edit Window".
You should now have a separate Code Editor window for fMainForm.pas belonging to Project2.
Move the new edit window away somewhere, to the other monitor perhaps, so you can see the other editor window where you've set the breakpoint.
Run the project.
The breakpoint occured on the second editor window - incorrectly.
2) You may also reproduce this bug by not using the project group. File -> Close All. Open Project1.dproj; then open fMainForm.pas from Project2 using File -> Open.  Any breakpoints set in fMainForm belonging to Project1 will occur in Project2's fMainForm.
3) Actually, you don't need to open a new tab for this to fail.  Follow the above steps and skip the step that opens a new editor tab; the bug occurs all the same.

After writing this I discovered that if you set breakpoint in fMainForm (Project2), but try to debug Project1, the breakpoint will occur in fMainForm (Project1).


On a side note, I believe this bug is related to a former functionality in the IDE which allowed multiple Code Editor tabs for the same file.  This was a useful feature as it allowed working on a large file in different sections, e.g. working on a similar method, or having 1 editor window show the interface, while you're working on implementation in another editor.  Without this feature, users are forced to use external editors which is a shame. Also, the context menu for the Editor tabs had an item "New Editor Window" which was removed; why? Whilst on the subject of Code Editor tabs Context Menu, adding "Open File Location" would be a useful feature.
Workarounds
None
Attachment
None
Comments

Daniel Frimerman at 5/30/2012 2:26:15 AM -
Same problem in XE2, 16.0.4504.48759

Server Response from: ETNACODE01