Version Used: Latest master branch
Steps to Reproduce:
Use Tools→Options to configure a preference to never use expression bodied properties, with severity Suggestion
Add a .editorconfig with the following line to override the one in Tools→Options
csharp_style_expression_bodied_properties = true:suggestion
Add the following to a document
internal class MyExample
{
public int X
{
get
{
return 3;
}
}
public int Y => 5;
}
On the line with return 3, use the light bulb to Fix All in Document.
Expected Behavior:
internal class MyExample
{
public int X => 3;
public int Y => 5;
}
Actual Behavior:
internal class MyExample
{
public int X
{
get
{
return 3;
}
}
public int Y { get => 5; }
}
@jinujoseph Can we reconsider this for 15.3? Fix All operations are currently ignoring the user's .editorconfig preferences. We enabled Fix All for several new full-solution scenarios in 15.3 and it will appear to be doing the wrong (opposite of correct) thing for users who are relying on .editorconfig for settings code style options.
The above example is a concrete reproducer, but I believe this issue affects all code style options.
In addition to the explanation above, if you want the Fix All to work you need to have your VS options for the rule matching the editorconfig option AND have some severity set for the VS options. A severity of None will not work.
This issue has been open for over a year and other duplicates have been closed since then. Is this hitting any near-term roadmap?
@sharwell what version is this fixed in? 15.8 p2, p3, something else?
@onovotny 15.8 Preview 3
Any chance you tested it the implicit accessibility modifiers?
https://github.com/onovotny/SignService/blob/master/.editorconfig#L51
Does it remove anything that doesn't fit?
I didn't test it explicitly, but if it was an issue of Fix All not behaving like individual fixes then it should be corrected.
It was that -- and also on things like other quick fixes. If I did a quick fix to introduce a field from a ctor variable, it added the private despite that being set.
If I did a quick fix to introduce a field from a ctor variable, it added the private despite that being set.
This is unrelated. You'll want to file a new bug if one doesn't already exist.
I thought there was one, but here's a new one https://github.com/dotnet/roslyn/issues/27716