dotnet / dotnet/vscode-csharp

Bug: Arbitrary Rename Requests On Incorrect Calls

Open
#3,007 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

## Steps to reproduce

```
public class A {
public void MyMethodToRename(Param1 param1) {}

void Main() {
MyMethodToRename();
}
}
```
At this stage, right click "MyMethodToRename" (note that we have incorrect parameters in our call, and thus the wrong signature) and MyMethodToRename will be...uh...renamed, but our CALL of my method to rename, which we just rightclicked to rename, will *not* be. I suspect because it's not a valid call. I would rather error out on this I think.

## Expected behavior
It renames the incorrectly called method that I just right clicked, or refuses the rename request.

## Actual behavior
It renames all the valid calls of the invalid thing I just called.

AH!! Important!!
This made me curious and now this is a real bug:

If we made a class like this:
```
public class A {
public void MyMethodToRename(Param1 param1) {}
public void MyMethodToRename(Param2 param2) {}

void Main() {
MyMethodToRename();
}
}
```
Notice that we have a overloaded Method now (they have different parameter types). When we rename MyMethodToRename on an incorrect call like this, we will consistent get the First Method renamed, which is arbitrary. I think 100% it needs to be rejecting this rename requests, ESPECIALLY in overloaded ops.

Thanks guys, let me know if you need any more info. Love Omnisharp and love using VSC with it!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.