Version Used: Visual Studio 2019 Version 16.7.5
Steps to Reproduce:
IDE0063 'using' statement can be simplified:using System;
using System.IO;
class C
{
static void Main()
{
using (var s = new MemoryStream()) // foo
{ // bar
Console.WriteLine(s.CanRead); // Only this comment remains.
} // baz
}
}
Use simple 'using' statementExpected Behavior:
All comments remain like this:
using System;
using System.IO;
class C
{
static void Main()
{
using var s = new MemoryStream(); // foo
// bar
Console.WriteLine(s.CanRead); // Only this comment remains.
// baz
}
}
Actual Behavior:
"foo", "bar", "baz" comments are deleted:
using System;
using System.IO;
class C
{
static void Main()
{
using var s = new MemoryStream();
Console.WriteLine(s.CanRead); // Only this comment remains.
}
}
We would take a targetted PR that updated things to have this behavior.
I can take a look at it.
Expected Behavior:
All comments remain like this:using System; using System.IO; class C { static void Main() { using var s = new MemoryStream(); // foo // bar Console.WriteLine(s.CanRead); // Only this comment remains. // baz } }
Ok, so I managed to resolve the issue, but instead I get aligned comments as follows:
using System;
using System.IO;
class C
{
static void Main()
{
using var s = new MemoryStream(); // foo
// bar
Console.WriteLine(s.CanRead); // Only this comment remains.
// baz
}
}
If that sounds acceptable, I'll gladly submit a PR.
Most helpful comment
I can take a look at it.