Reporter | Egor Malyshev (megor) |
---|---|
Created | Oct 14, 2011 5:18:09 PM |
Updated | Apr 20, 2018 6:13:59 PM |
Resolved | Apr 20, 2018 6:13:59 PM |
Subsystem | Refactorings |
Assignee | Alisa Afonina (alisa.afonina) |
Priority | Critical |
State | Obsolete |
Type | Bug |
Fix version | Backlog |
Affected versions | No Affected versions |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
I have this code:
Note that there is a call to shared ContainsWords from ProjectItem class. Now, I see that this part CType(ti.Tag, ProjectItem) is used 3 times a row, so it's wise to extract a variable, which is what I do, but here's a bummer:
R# has introduced variable with name projectItem, which has replaced ProjectItem in call to shared sub, and now I have to correct it manually, because even if I use Rename on variable, it will replace projectItem before ContainsWords too, which would still render my code broken.
If Not ProjectItem.ContainsWords(CType(ti.Tag, ProjectItem).NameFormatted, Format("{0} {1}", CType(ti.Tag, ProjectItem).DisplayName, finderCombo.Text)) Then
speedFinder.Items.Remove(CType(ti.Tag, ProjectItem).AsDropDownItem)
End If
Note that there is a call to shared ContainsWords from ProjectItem class. Now, I see that this part CType(ti.Tag, ProjectItem) is used 3 times a row, so it's wise to extract a variable, which is what I do, but here's a bummer:
Dim projectItem As ProjectItem = CType(ti.Tag, ProjectItem)
If Not projectItem.ContainsWords(projectItem.NameFormatted, Format("{0} {1}", projectItem.DisplayName, finderCombo.Text)) Then
speedFinder.Items.Remove(projectItem.AsDropDownItem)
End If
R# has introduced variable with name projectItem, which has replaced ProjectItem in call to shared sub, and now I have to correct it manually, because even if I use Rename on variable, it will replace projectItem before ContainsWords too, which would still render my code broken.