manski's blog

Bug of the day: Broken renaming in ReSharper

In my opinion, refactoring is the way to keep a software project clean. So, it’s good to have tools that support the refactoring process.

ReSharper is such a tool. It provides refactoring capabilities for C#/Visual Studio.

Unfortunately, the renaming code in ReSharper currently (version 7.1.1) contains a bug. This bug may prevent ReSharper from renaming all occurrences of a certain symbol.

The following code exhibits this problem:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
 
public class SomeOtherClass {
  public string GetString(int col) {
    return null;
  }
}
 
public class MyClass {
  public void YouCantRenameMe() { }
 
  public void ThisFunctionBreaksTheRenaming() {
    // The following line breaks the renaming.
    SomeFunction((row) => row.GetString(0));
  }
 
  public void SomeFunction<T>(Func<SomeOtherClass, T> func) {
    YouCantRenameMe();
  }
}

If you try to rename the method YouCantRenameMe() (in line 10), ReSharper won’t rename the method call in line 18.

The problem is the code in method ThisFunctionBreaksTheRenaming() which somehow breaks the renaming process.

Update: This bug is not present in version 7.1. So, for now, I’ve downgraded to this version.

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *