Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Refactor in .cpp changes signature of header only

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
jase439 Posted - Oct 25 2012 : 9:16:33 PM
I would like to report a bug in VAX 1916 under VS2010 SP1.

When you right click on a method name *in the source module* to Refactor the signature of a class method, the method's signature is correctly altered in the header at the point of declaration, but not at the point of definition in the source module where the user issued the command. The source file does not change and the method's signature must be manually edited.

Contrast this behavior with Refactor | Rename, in which the method under the cursor is modified.

Expected behavior: when a signature is changed via Refactor, both the declaration and the definition signatures should change to match.
7   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Nov 16 2012 : 3:29:11 PM
Can you try copying the cpp and matching .h file where you see this problem from your main solution, and adding these copies to the test solution I uploaded please. After closing and reloading the IDE, to make sure that all changes to the solution have been saved and picked up by VA, can you try Change Signature and see if you can reproduce the problem here?

If this problem is caused by something confusing our parser then it might be file specific. In which case this test should reproduce the problem.

If the Change Signature works correctly here, would you be able to make a copy of the entire project from your main solution and add it to the test solution, and then see if the problem can be reproduced? Again I am just trying to see where the trigger for the problem might be, without causing any disruption to your main solution.

If this is a parser problem it could be in a common header file you use, a library you are using, perhaps a 3rd party library.
jase439 Posted - Nov 13 2012 : 6:14:34 PM
This solution seems to work fine. I also tried checking the project files into version control just to see if it was interfering and it wasn't. Seems to be something unique the setup of the project I'm currently working on (it is consistently repeatable, however, on different systems with this particular project at least).

I don't know how else to explain the repro steps differently from what I've mentioned above. I presume we are issuing the same commands: it just happens to work in the sample app but chokes in development.
feline Posted - Nov 08 2012 : 8:30:05 PM
I have created a new VS2010 console solution, and added a pair of files with various test functions, to use Change Signature on. I have uploaded it here:

http://forum.wholetomato.com/colin/forumimages/topic10989_va_test_refactoring.zip

Can you please try downloading and opening this solution, and see if you can reproduce this problem by running Change Signature in the files "test_change_signature.cpp" and "test_change_signature.h"

If so, how are you reproducing the problem? I cannot reproduce the problem using this test solution.
jase439 Posted - Nov 08 2012 : 12:44:13 AM
quote:
Are you able to reproduce this effect on demand?


Yes. It's very repeatable for me. I just confirmed the issue is still present in 1918.

quote:
Are you able to reproduce this problem in a new default solution you have added a simple test function to?


I can try. Very busy at the moment, however, so if there's a quicker way to diagnosing the problem, that might be a better road.

quote:
I am wondering if this is reliable or random. If this is reliable it could be there is something in the cpp file that is confusing our parser, or stopping VA from updating the cpp file as intended, which is why I asked about the cpp file being read only.



I thought of this also. I wondered if maybe my P4SCC (Perforce) plug-in might be interfering in someway. If both source and header are read-only, VAX has no problem "checking out" the header file, making it writable, and modifying it. It leaves the .CPP unchanged. To test this, I touched both header and source files and saved them as to make them both read/writable. I repeated the test with the same result (header signature changed, source did not).

EDIT: just to rule out P4SCC, I removed the source control bindings, disabled the plug-in, closed the solution and reopened it. I repeated the test, and the refactor operation still fails.

Another observation, the source window "flashes" and briefly, scrolls to the top and then back to the current line when I use Change Signature...almost as if VAX was trying to change the file but somehow could not.

Also, after issuing the Change Signature command, VAX shows the source implementation in the VA Find References Results window "as-if" the implementation was a "usage" of the function (like it was an invocation rather than the function definition).

Lastly, if I issue the Change Signature command on the declaration in the header file, the result is the same: the header file changes as expected, but the corresponding source implementation remains unaffected.
feline Posted - Nov 03 2012 : 12:48:52 PM
Thank you, this is very clear, and this is a significant problem. So far I am unable to reproduce this problem, and this is definitely not what is supposed to happen.

Are you able to reproduce this effect on demand?

Are you able to reproduce this problem in a new default solution you have added a simple test function to?

I am wondering if this is reliable or random. If this is reliable it could be there is something in the cpp file that is confusing our parser, or stopping VA from updating the cpp file as intended, which is why I asked about the cpp file being read only.
jase439 Posted - Nov 03 2012 : 10:58:44 AM
> Since you are comparing this to the Refactor | Rename command, I am assuming you are renaming the function.

I was contrasting the behavior of Refactor | Rename (works as expected) versus Refactor | Change Signature (does NOT work as expected). In this particular instance, I was changing the type of a method parameter (i.e. int to long) by electing Change Signature with the cursor over the method to be changed in the source (.CPP) file. I changed the function signature as desired and OK'd it. When I did this, the signature in the corresponding header file (.H) WAS changed (so I presume ALT+G is fine but did not test this command explicitly) but the signature of the implementation under the cursor in the currently open source file (.CPP) WAS NOT.

Hope that's clearer.
feline Posted - Oct 26 2012 : 8:56:06 PM
Which VA refactoring command are you using?

What change are you making to the function signature?

Since you are comparing this to the Refactor | Rename command, I am assuming you are renaming the function. I have tried this with both Change Signature and Rename VA commands, and both the .h and .cpp files are being updated correctly for me.

Can you reproduce this problem on demand?
Are you getting any error messages?
Is the .cpp file you are working in read only?

If you use Alt-g on the function, before trying to rename it, does VA correctly jump between the declaration and definition?
If you run Find References on the function, is VA finding both the declaration and the definition?

Something is obviously going wrong, we just need to find out what is triggering the problem.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000