You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StyleCop's SA1000 wants you to have a space between new and () when you're using Type Inference.
We have some devs using PPT and VS 2019 on a .NET Core project that has SA1000 active. We haven't found a setting to turn off the new () to new() change when "Format document on save" is selected.
Expected after format
public static void TestMe()
{
List<string> a = new () // Format document takes this back out!
{
"spam",
"ham",
"Sam"
};
System.Diagnostics.Debug.WriteLine(a[0]);
}
Actual after format
public static void TestMe()
{
List<string> a = new() // <<<< StyleCop SA1000 complains here
{
"spam",
"ham",
"Sam"
};
System.Diagnostics.Debug.WriteLine(a[0]);
}
In a perfect world, if you have SA1000 enabled, "format document on save" would leave the space after new and before ().
(Yes, I'm suspicious this is a "We're just calling VS' format from Edit >>> Advanced >>> Format Document" issue.)
The text was updated successfully, but these errors were encountered:
ruffin--
changed the title
Need a "Format document on save" setting that matches SA1000
"Format document on save" incompatible with SA1000
Feb 17, 2022
StyleCop's SA1000 wants you to have a space between
new
and()
when you're using Type Inference.We have some devs using PPT and VS 2019 on a .NET Core project that has SA1000 active. We haven't found a setting to turn off the
new ()
tonew()
change when "Format document on save" is selected.Expected after format
Actual after format
A+ with garlands
In a perfect world, if you have SA1000 enabled, "format document on save" would leave the space after
new
and before()
.(Yes, I'm suspicious this is a "We're just calling VS' format from Edit >>> Advanced >>> Format Document" issue.)
The text was updated successfully, but these errors were encountered: