Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.7.4
Microsoft .NET Framework Version 4.8.04084
Steps to Reproduce:
Add the following lin to .editorconfig:
"dotnet_diagnostic.IDE0052.severity = suggestion"
Setup Visual Studio such that on save a code cleanup is run. Tools -> Options -> Text Editor -> Code Cleanup -> Tick box that says "Runc Dode Cleanup profile on Save"
Now setup Code Cleanup to "Fix all warnings and errors set in EditorConfig". Analyze -> Code Cleanup -> Configure Code Cleanup -> Move the fixer up such that it is active
Create a C# file that has the following source code:
using System;
internal static class C {
private static void Main() {
// Accepting suggestion "IDE0053 Use expression body"
// leads to changed behavior:
P(() => { DoWork(); });
}
private static void P(Action a) {
Console.WriteLine("P: action");
a();
}
private static void P(Func<bool> f) {
Console.WriteLine("P: func");
bool r = f();
Console.WriteLine("f returned " + r);
throw new Exception();
}
private static bool DoWork() {
Console.WriteLine("Working");
return true;
}
}
Diagnostic Id:
"dotnet_diagnostic.IDE0052
Expected Behavior:
I would not expect it to change the behaviour of the delegate
Actual Behavior:
It changed the behaviour of the delegate such that it was no longer a delegate returning "void" but instead it returns the actual value.
Version Used:
Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.7.4 Microsoft .NET Framework Version 4.8.04084 Steps to Reproduce:
Add the following lin to .editorconfig: "dotnet_diagnostic.IDE0052.severity = suggestion" Setup Visual Studio such that on save a code cleanup is run. Tools -> Options -> Text Editor -> Code Cleanup -> Tick box that says "Runc Dode Cleanup profile on Save" Now setup Code Cleanup to "Fix all warnings and errors set in EditorConfig". Analyze -> Code Cleanup -> Configure Code Cleanup -> Move the fixer up such that it is active Create a C# file that has the following source code:
Diagnostic Id: "dotnet_diagnostic.IDE0052
Expected Behavior: I would not expect it to change the behaviour of the delegate
Actual Behavior: It changed the behaviour of the delegate such that it was no longer a delegate returning "void" but instead it returns the actual value.