Reporter |
|
---|---|
Created | Mar 29, 2018 7:05:01 PM |
Updated | Apr 5, 2018 5:49:58 PM |
Subsystem | Code Analysis - C# |
Assignee | Andrey Dyatlov (Andrey.Dyatlov) |
Priority | Critical |
State | Submitted |
Type | Bug |
Fix version | 2018.1.1 |
Affected versions | 2017.3.5 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
ReSharper is to eager and wants to refactor two if statements (not if, if-else) to a swtich with break after each refactoring.
This will change the bussinness logic and could be catastrophic.
We got this issue in our main codebase, and I have here reproduced it in it's own little project.
Everything on latest and greatest stable (ReSharper and Visual Studio).
ReSharper does not refactor wrong if it can see a class implementing both interfaces, however.
In our main codebase, this code runs in a library with the interfaces and logic, and the class itself is located in another solution/nuget.
Loading done through private NuGet packages.
So there is no way for ReSharper to actually take those assumptions correctly, therefor it should not do it at all (as everyting is publicly declared).
This will change the bussinness logic and could be catastrophic.
We got this issue in our main codebase, and I have here reproduced it in it's own little project.
Everything on latest and greatest stable (ReSharper and Visual Studio).
ReSharper does not refactor wrong if it can see a class implementing both interfaces, however.
In our main codebase, this code runs in a library with the interfaces and logic, and the class itself is located in another solution/nuget.
Loading done through private NuGet packages.
So there is no way for ReSharper to actually take those assumptions correctly, therefor it should not do it at all (as everyting is publicly declared).