Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 1715: Rename
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

khb
Tomato Guru

Germany
337 Posts

Posted - Mar 15 2009 :  07:14:33 AM  Show Profile  Reply with Quote
I'm still doing some refactoring using VC6/1715. While using Rename it now happend two times to me that a certain variable was not renamed but completely removed from the code. Maybe I'm typing to fast or whatever. Of course this only happens occasionally so it's difficult for me to describe how to reproduce it. I believe it happens if I quickly rename a variable again after just renaming it. Anyway, it is difficult to undo this operation if you have a lot of occurences. Or is there a "Undo Rename" options somewhere?

Regards
Marcus

khb
Tomato Guru

Germany
337 Posts

Posted - Mar 15 2009 :  10:43:18 AM  Show Profile  Reply with Quote
It just happend a third time. I renamed two member functions of the same class. The first rename worked but the second one removed the function name completely from my code. And I still habe no idea how to undo this. Even compiling doesn't help because a pure comma-separated function parameter list in brackets is valid code. These days I love my backups...

Regards
Marcus
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Mar 16 2009 :  1:33:21 PM  Show Profile  Reply with Quote
First undoing the rename. VC6 makes undo "hard", so you have to undo each step of the rename manually, in each file.

There is some good news here though. All of the files that are effected by the rename have to be opened in VC6, and then modified. So if you look in the IDE Window menu at the list of modified files, these are probably the files you need to fix / undo in. This assumes most open files were not modified before the rename.

This way at least you can locate the files you need to fix.

You might also have some luck looking in the directory:

C:\\Documents and Settings\\ <USERNAME> \\Local Settings\\Application Data\\VisualAssist\\vc6\\history\
for older copies of the files that have just been modified. No guarantees here, but it is worth a look.


The problem you are seeing, clearly this is very bad!

Do you remember seeing this problem in an earlier version of VA?
How, exactly, are you triggering rename?

I have just tried this here, renaming a class that is referenced in three files, using VC6 and VA 1715. I used Shift + context menu on the keyboard to open VA's Shift + Right click menu, and selected Rename from the refactoring sub-menu. I did 4 renames in a row, very quickly, and each of the renames seemed to work correctly.

I had the correct number of items to rename each time in the rename dialog, spread across the three files.

zen is the art of being at one with the two'ness
Go to Top of Page

khb
Tomato Guru

Germany
337 Posts

Posted - Mar 17 2009 :  04:09:36 AM  Show Profile  Reply with Quote
Hello feline,

thank you for your answer. I already tried an "undo" as you describe it, but it is difficult if you have 50 modified files open and only 20 have been affected by the last Rename. My solution is to open a backup workspace in a new IDE and run Find References there. This way I can locate the code to fix without doing wrong "undos" in the wrong files.

Back to the problem: I always hover over a symbol until the small VA arrow for the refactoring menu appears. Then I press "Rename". In the Rename dialog I modify the symbol name and then sometimes I press Return and sometimes the Rename button. Unfortunately, I don't remember if there is a correlation between the Return key or the Rename button and the false behavior. Anyway, I'm not sure anymore if speed is a factor. When I got the problem described in my second post I renamed the first function and triggered Rename quite immediately after it again. But then I paused for 2 minutes before I edited the function name in the Rename dialog and eventually triggered the renaming. Again, I don't remember if I hit the Rename button or pressed the Return key to do this.

If you have more questions, please ask.

Regards
Marcus
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Mar 17 2009 :  12:27:06 PM  Show Profile  Reply with Quote
Are you ever seeing the wrong result with Find References?

When you run Rename, does the Rename dialog seem to be listing the correct number of files and references, or is it seriously / obviously wrong?

I am trying to work out if this is a parser level (find the references) problem or an update the files level problem. The fact that you can use Find References to help undo the Rename problem suggests that Rename knew what to do, but did it wrong.

Is the solution on a local drive, or some form of network drive?
What source control system are you using?
Are the source files checked out and editable, or mostly checked in and read only?
What anti-virus are you using?

I am searching for anything that might interfere with VA's ability to update your files. If something blocked VA half way through the rename this might explain some of this, but does it also explain removing the function name from the files? *sigh*

Do you have any other IDE plugin's installed?

zen is the art of being at one with the two'ness
Go to Top of Page

khb
Tomato Guru

Germany
337 Posts

Posted - Mar 18 2009 :  04:24:09 AM  Show Profile  Reply with Quote
I've never seen that Find References showns wrong results. Very often I call Find References before calling Rename in order to get an overview. When opening the Rename dialog then the listed references are identical, as far as I noticed. So my feeling is that it might be something with the update routine. I mean, all symbols at the listed locations are modified, but not in the correct way, i.e., deleted and not renamed.

All files are on my local drive. Source control is simply done by backing up the complete project directory, so there is no interference with a source control system. Consequently, also no file is read-only. The anti-virus software I use is freeAVG (7.5, I think). And I don't have any add-ins besides VA.

Regards
Marcus

Edited by - khb on Mar 18 2009 04:29:35 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Mar 18 2009 :  10:37:10 AM  Show Profile  Reply with Quote
I am going to have to ask our developers and see if they have any ideas:

case=25190

One last question, if you undo a problem rename and then re-do the rename does it work the second time, or does it still fail?

I am wondering if this problem is really random, or if it just looks random, since it needs a specific initial state.

One more thought, how often do you see this? Once a month, once a week, 3 times a day? I am wondering about turning on VA logging, if this is fairly common, and waiting for it to happen.

zen is the art of being at one with the two'ness

Edited by - feline on Mar 18 2009 10:46:39 AM
Go to Top of Page

khb
Tomato Guru

Germany
337 Posts

Posted - Mar 19 2009 :  12:10:14 PM  Show Profile  Reply with Quote
In all three cases where Rename failed for me I gave it a second try. And in all these cases Rename worked then as expected. The three incidents occurred within a half days work where I did a lot of refactoring. Maybe I did around 50 to 100 Renames within this period (wild guess). The first two failures (on member variables, I think) occurred within 15 minutes or so and the third one (on a member function) about two hours later. So it seems quite random to me.

Regards
Marcus
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Mar 19 2009 :  6:29:17 PM  Show Profile  Reply with Quote
Do you remember which symbols you had a problem with? If so can you run Find References again and tell me how many results are found, and across how many files?

Rename does get put through some stress tests, but probably not across as many files as you updated, so I will try setting up some similar sized stress tests here.

zen is the art of being at one with the two'ness
Go to Top of Page

khb
Tomato Guru

Germany
337 Posts

Posted - Mar 20 2009 :  03:55:41 AM  Show Profile  Reply with Quote
I renamed so many symbols that I can't exacly remember. I had about 20 to 30 files open and the references in all three cases were not so many. Maybe 5 to 20 references across 3 to 10 files. So the problem didn't happen for me in what I would call an extreme situation...

Regards
Marcus.
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Apr 10 2010 :  9:19:21 PM  Show Profile  Reply with Quote
case=25190 is fixed in build 1819

Whole Tomato Software, Inc.
Go to Top of Page

khb
Tomato Guru

Germany
337 Posts

Posted - Apr 13 2010 :  04:34:57 AM  Show Profile  Reply with Quote
I'm glad that you found the problem and fixed it. I really stopped doing major renames. Thanks a lot!

Regards
Marcus
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000