Skip to content

Conversation

@anhthidao
Copy link
Contributor

Analyzer: Suggest replacing builder.Host.ConfigureAppConfiguration/builder.Host.ConfigureHostConfiguration/builder.WebHost.ConfigureAppConfiguration with builder.Configuration directly

Description

Add analyzers that warns when using ConfigureAppConfiguration/ConfigureHostConfiguration on WebApplicationBuilder.Host/WebApplicationBuilder.WebHost. Suggest switching to builder.Configuration.

Fixes #35815

@dnfadmin
Copy link

dnfadmin commented Jun 22, 2022

CLA assistant check
All CLA requirements met.

@anhthidao anhthidao changed the title Web application builder analyzers Analyzer: Suggest replacing builder.Host.ConfigureAppConfiguration/builder.Host.ConfigureHostConfiguration/builder.WebHost.ConfigureAppConfiguration with builder.Configuration directly Jun 22, 2022
@anhthidao anhthidao changed the title Analyzer: Suggest replacing builder.Host.ConfigureAppConfiguration/builder.Host.ConfigureHostConfiguration/builder.WebHost.ConfigureAppConfiguration with builder.Configuration directly Implementing analyzer to prefer WebApplicationBuilder.Configuration over Configure methods Jun 22, 2022
"Do not use builder.Host.ConfigureAppConfiguration or builder.Host.ConfigureHostConfiguration",
"Replace with builder.Configuration",
"Usage",
DiagnosticSeverity.Error,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make this one a warning like #42354 and #42356 as this doesn't functionally break an application if it's used.

anhthidao and others added 4 commits June 23, 2022 10:16
… and message. Changing the WebApplicationBuilderAnalyzers class so that the method name can be passed into the diagnostic message
… and message. Changing the WebApplicationBuilderAnalyzers class so that the method name can be passed into the diagnostic message
@Pilchie Pilchie added the old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Jun 25, 2022
@anhthidao anhthidao merged commit 621326b into main Jun 29, 2022
@anhthidao anhthidao deleted the WebApplicationBuilderAnalyzers branch June 29, 2022 16:06
@ghost ghost added this to the 7.0-preview7 milestone Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Projects

None yet

6 participants