[1723] Incorrect refactoring?

Hello,

this is related to VB and Visual Studio 2010.

i want to extract a few lines from a function into a separate method becase the code is also used in other functions. I expected R# generates a sub without parameters as the marked code only uses variables defined in class scope. But it generates a sub with parameters and the parameters will not be used in the generated method. I have attached a screenshot which shows the refactoring. I'm not shure if this is an error or an expected behavior.

Regards
Klaus



Attachment(s):
ExtractMethod.PNG
2 comments
Comment actions Permalink

Hello Klaus,

Thank you very much for reporting this problem! I'm afraid I wasn't able
to reproduce this behavior. Could you please attach a small sample solution
which would exhibit this behavior?

Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Hello,

this is related to VB and Visual Studio 2010.

i want to extract a few lines from a function into a separate method
becase the code is also used in other functions. I expected R#
generates a sub without parameters as the marked code only uses
variables defined in class scope. But it generates a sub with
parameters and the parameters will not be used in the generated
method. I have attached a screenshot which shows the refactoring. I'm
not shure if this is an error or an expected behavior.

Regards
Klaus
---
Original message URL:
http://devnet.jetbrains.net/message/5266913#5266913



0
Comment actions Permalink

here comes the sample...

try to "Extract Method" the line SaveUserAndTime(...) and the two following lines starting with "Call ..."
in SaveProperty() of Class1 to reproduce the issue.

There was another issue in this method for which i entered an issue in YouTrack directly (RSRP-185159)
which you can reproduce with this piece of code. Just copy the three lines of "ShowSaveErrorMessage"
between the "#If DEBUG..." and try to "Extract Method". You will see that the metho call is placed above
the "#If..." instead between "#If..." and "...#End If".

Develop with pleasure :)

Klaus



Attachment(s):
ExtractMethod.zip
0

Please sign in to leave a comment.