# Water . 2293: IDE Bug when Completing classes

**URL:** https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623
**Category:** Water
**Tags:** oxygene
**Created:** [June 12, 2018, 12:16pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623 "2018-06-12T12:16:55Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Michael\_Thuma](https://talk.remobjects.com/user_avatar/talk.remobjects.com/michael_thuma/32/5609_2.png) [@Michael\_Thuma](https://talk.remobjects.com/u/Michael_Thuma)
#### Post date: [June 12, 2018, 12:16pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/1 "2018-06-12T12:16:55Z")

</div>

Steps to reproduce:  
a) Create a class in a module that uses interface and implementation section  
b) Add a method  
c) Complete the class Crtl + Shift C  
d) Rename the method  
d1) Don’t remove the old implementation (the method name can no longer be found in the classes interface)  
e) complete the class Crtl + Shift C

IDE is no amused but will continue to perform well after pressing Continue … (an exception is thrown)

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [June 12, 2018, 2:51pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/2 "2018-06-12T14:51:14Z")

</div>

> [@Michael\_Thuma](#):
>
> IDE is no amused

Sorry, but I’ve stopped tarrying to reproduce bug descriptions that make me _guess_ what the bug might be, because it usually ends up with me not reproducing the issue because a step is missing, and going on.a child goose chain _assuming_ what problem I’m lookin for

What exactly goes wrong?

---

<div class="post-metadata">

### Author: ![Michael\_Thuma](https://talk.remobjects.com/user_avatar/talk.remobjects.com/michael_thuma/32/5609_2.png) [@Michael\_Thuma](https://talk.remobjects.com/u/Michael_Thuma)
#### Post date: [June 12, 2018, 4:50pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/3 "2018-06-12T16:50:28Z")

</div>

What goes wrong?

The IDE throws an exception.

You declare a method in the interface. Implement it, maybe via completing a class. Change the method signature (name) and complete class. Water throws an exception.

If you delete the methods implementation before completing the class it works.

This sounds litte strange but can happen and I think in very rare cases, but maybe by accident.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [June 12, 2018, 6:50pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/4 "2018-06-12T18:50:05Z")

</div>

> [@Michael\_Thuma](#):
>
> The IDE throws an exception.

Ok, what’s the exception? Can I see a concrete testcase?

---

<div class="post-metadata">

### Author: ![Michael\_Thuma](https://talk.remobjects.com/user_avatar/talk.remobjects.com/michael_thuma/32/5609_2.png) [@Michael\_Thuma](https://talk.remobjects.com/u/Michael_Thuma)
#### Post date: [June 12, 2018, 8:27pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/5 "2018-06-12T20:27:03Z")

</div>

The Exception

Index was outside the bounds of the array.  
at System.String.get\_Chars(Int32 index)  
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.rangeOfIdentifierAtCursorX\_\_\_\_y(Int32 x, Int32 y)  
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.makeSoftSelectionAtCursorX\_\_\_\_y\_\_expandBeyond(Int32 x, Int32 y, Boolean expandBeyond)  
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.makeSoftSelectionForPopup(Boolean expandBeyond)  
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.initiatePopupWithMessage\_\_\_\_withSoftSelection(String message, Boolean withSoftSelection)  
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.initiatePopupWithMessage(String message)  
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.refactorCallback\_\_\_\_\_\_action(FCERefactoringResults results, FCECodeEditorSmartsFeedback feedback, Action`1 action)  
at RemObjects.Fire.CodeEditor.FCECanvasCodeSnippet.b\_\_0(FCERefactoringResults results, FCECodeEditorSmartsFeedback feedback)  
at RemObjects.Fire.ProjectSystem.TextFile.\<\>c\_\_DisplayClass82.b\_\_4()  
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)  
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

* * *

The Code:

namespace ca;

interface

type TMike = class  
private  
method DoSomething: Integer;  
public  
protected  
method DoSomething2 : integer;  
constructor;  
end;

implementation

method TMike.DoSomething: Integer;  
begin

end;

method TMike.DoSomething2: Integer;  
begin

end;

## end.

a) I added method DoSomething : Integer;  
b) CRTL+SHIFT+C  
c) added constructor  
d) changed the method’s name to DoSomething2

* * *

Complete Class (CRTL + Shift + C). That moment the exception is thrown

## method DoSomething was shifted from the public to the private section and the code for the constructor was not added but the one for the functions name.

## (no idea why the sentence above is formatted that way (sorry)

[ca.zip](https://talk.remobjects.com/upload![IDE_Exception_CTRL_C|690x283](upload://m1ZM6rWw1kPLr8Z10EGXbXTJt8e.png)s/default/original/2X/6/6f0560c63f3aedb807e92a39768f5ab4da9f5223.zip) (62.1 KB)

 ![IDE_Exception_CTRL_C](https://talk.remobjects.com/uploads/default/original/2X/9/9a69996aacf5c583b4f9fff712c5229b88c6425a.png)

---

<div class="post-metadata">

### Author: ![Michael\_Thuma](https://talk.remobjects.com/user_avatar/talk.remobjects.com/michael_thuma/32/5609_2.png) [@Michael\_Thuma](https://talk.remobjects.com/u/Michael_Thuma)
#### Post date: [June 12, 2018, 8:40pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/6 "2018-06-12T20:40:15Z")

</div>

Maybe it has something to do with the constructor. Not totally certain about the impact of the constructor keyword or just the presence of a second method.

Class completion also works if I add the sole constructor keyword before and after the method name. I do have the impression that if no implementation of the procedure can be found even such an error prone case is handled the correct way.

In the just normal case changing a methods name and completing a class works. Both implementations can be found. One remains and the the new is added.

Anyway existing declarations are moved to the private section. In this specific test case it’s method DoSomething. In the case the thread is about one method whose signature did not change was moved to the privat section. (irrc).

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [June 12, 2018, 8:48pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/7 "2018-06-12T20:48:15Z")

</div>

Doesn’t repro here —which is the entire realism I’m being anal out his this is being reports. Please send me an _exact_ project that reproduces this, and the exact position in code where you invoke Complete Class.

thanx,

---

<div class="post-metadata">

### Author: ![Michael\_Thuma](https://talk.remobjects.com/user_avatar/talk.remobjects.com/michael_thuma/32/5609_2.png) [@Michael\_Thuma](https://talk.remobjects.com/u/Michael_Thuma)
#### Post date: [June 12, 2018, 9:08pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/8 "2018-06-12T21:08:16Z")

</div>

No Problem. Added the most minimalist case

Open the file (maybe add it to a command line solution).  
Move to the line method DoSomething  
Complete Class  
-Should work  
Change the name of DoSomething to DoSomething2  
Excepetion should occur

Observations  
a) Code completion for constructor fails even in case of no exception (could be the origin)  
b) method DoSomething completed correctly  
c) After modifying methods’s Name to DoSomething2 the Water IDE creates the implementation for DoSomething2 and  
c1) adds the declaration of DoSomething to the private section (ok that makes sense now, but I didn’t expect that)  
d) don’t get confused, also methods deleted (both interface and implementation) can show up in the private section.

[Codefile3.pas](https://talk.remobjects.com/uploads/default/original/2X/3/34edb71fc90970e9878705423f90c2b88f52237c.pas) (173 Bytes)

---

<div class="post-metadata">

### Author: ![Michael\_Thuma](https://talk.remobjects.com/user_avatar/talk.remobjects.com/michael_thuma/32/5609_2.png) [@Michael\_Thuma](https://talk.remobjects.com/u/Michael_Thuma)
#### Post date: [June 12, 2018, 9:10pm UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/9 "2018-06-12T21:10:47Z")

</div>

Another funny thing happend too but not this time, just last time and only once. The Delphi IDE tried to open up and crashed with a code fragment in an editor window pretty similar to a part of the class.

I hope the exception you see does origin from Water, but I’m pretty sure it does.

---

<div class="post-metadata">

### Author: ![Michael\_Thuma](https://talk.remobjects.com/user_avatar/talk.remobjects.com/michael_thuma/32/5609_2.png) [@Michael\_Thuma](https://talk.remobjects.com/u/Michael_Thuma)
#### Post date: [July 3, 2018, 8:31am UTC](https://talk.remobjects.com/t/water-2293-ide-bug-when-completing-classes/16623/10 "2018-07-03T08:31:29Z")

</div>

That problem doesn’t show up anymore. No idea why. 10.2.2.2293.

The only two things I did was to  
a) attach new flat-panel  
b) upgrade Delphi to 10.2.3

I turned off the ‘Program does not respond’ message and so on because of b).

Also a second phenomenon is gone.

When I clicked on references (since it does not show up in Fire or Water anymore I cannot swear that the Water IDE was involved) a pop-up window showing an exception appeared all of sudden on top of the debug pane).

Sorry for maybe having caused confusion.
