Reporter | Jakub Jiricek (jakub.jiricek@vodafone.com) |
---|---|
Created | Apr 4, 2018 8:51:13 PM |
Updated | Apr 19, 2018 1:56:12 PM |
Subsystem | Refactorings - Inplace |
Assignee | Alisa Afonina (alisa.afonina) |
Priority | Normal |
State | Submitted |
Type | Bug |
Fix version | No Fix versions |
Affected versions | 2017.3.5, 2018.1.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
in the following example,
when I use "inline method" on resharperTest2() I get
for a similar code without the try-catch block Resharper says it cannot inline the method so no problem is created in that case.
public void resharperTest1(int i)
{
int x = resharperTest2(i);
}
private int resharperTest2(int i)
{
try
{
if (i == 1) return 1;
return 2;
}
catch (Exception e)
{
return 3;
}
}
when I use "inline method" on resharperTest2() I get
public void resharperTest1(int i)which is incorrect, as the ret=1 assignment is always overwritten by ret=2.
{
int ret;
try
{
if (i == 1) ret = 1; //<---here is the bug
ret = 2;
}
catch (Exception e)
{
ret = 3;
}
int x = ret;
}
for a similar code without the try-catch block Resharper says it cannot inline the method so no problem is created in that case.