Area-IDEBugFeature - IDE0059help wanted
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (Avg merge 6d 17h) (256 merged PRs in 30d)
Description
Port of https://github.com/dotnet/roslyn/issues/51401#issuecomment-1065029095
Version Used: VS 2022 v17.2 Preview 1
Steps to Reproduce: Start code:
namespace ClassLibrary1
{
public class Class1
{
public string ReturnEmptyString()
{
#region region1
string returnValue = null;
#endregion
returnValue = string.Empty;
return returnValue;
}
}
}
Then apply IDE0059 on returnValue
Expected Behavior:
namespace ClassLibrary1
{
public class Class1
{
public string ReturnEmptyString()
{
#region region1
#endregion
returnValue = string.Empty;
return returnValue;
}
}
}
Actual Behavior:
namespace ClassLibrary1
{
public class Class1
{
public string ReturnEmptyString()
{
// This blank line should not be here
#region region1
#endregion
returnValue = string.Empty;
return returnValue;
}
}
}
Demo:
