-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port 'Top Level Statements' code style PR to 17.3 #60426
Port 'Top Level Statements' code style PR to 17.3 #60426
Conversation
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
…into programMain
…MainDiagnosticAnalyzer.cs Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
…sform_ProgramMain.cs Co-authored-by: David Wengier <david.wengier@microsoft.com>
Already signed off in: #60383 |
@@ -171,7 +171,10 @@ internal static class IDEDiagnosticIds | |||
|
|||
public const string RemoveUnnecessaryLambdaExpressionDiagnosticId = "IDE0200"; | |||
|
|||
public const string ForEachCastDiagnosticId = "IDE0210"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intentionally taking this ID. if we back port this dev17.2, we want to keep these IDEs the same there.
@@ -396,30 +396,21 @@ public void CSharp_VerifyIDEDiagnosticSeveritiesAreConfigurable() | |||
# IDE0090 | |||
dotnet_diagnostic.IDE0090.severity = %value% | |||
|
|||
# IDE0110 | |||
dotnet_diagnostic.IDE0110.severity = %value% | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorting, how does it work?
Provides a user facing option in VS to control preferences around top-level-statements. Looks like:
or
When set to prefer 'Program.Main' style, if a new project is created using a template that uses top-level-statements, then we will convert that template to use the traditional style like so:
This preference is also exposed through our standard analyzer/fixer/refactoring system so it can be used to change code after a project has already been created. For example an existing Program.Main program can be converted to a top-level-statement program (if viable):
Likewise, all top-level-statement programs can be converted back to a traditional Program.Main program: