328 references to DiagnosticDescriptors
Microsoft.AspNetCore.App.Analyzers (60)
Authorization\AddAuthorizationBuilderAnalyzer.cs (2)
19public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(DiagnosticDescriptors.UseAddAuthorizationBuilder); 231DiagnosticDescriptors.UseAddAuthorizationBuilder,
Http\HeaderDictionaryAddAnalyzer.cs (2)
17public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd); 75DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd,
Http\HeaderDictionaryIndexerAnalyzer.cs (2)
16public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer); 176DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer,
Http\RequestDelegateReturnTypeAnalyzer.cs (2)
17public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate); 79DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate,
Kestrel\ListenOnIPv6AnyAnalyzer.cs (3)
17public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => [ DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny ]; 69context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny, ipAddressArgumentSyntax.GetLocation())); 94context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny, ipAddressArgumentSyntax.GetLocation()));
Mvc\DetectAmbiguousActionRoutes.cs (1)
43DiagnosticDescriptors.AmbiguousActionRoute,
Mvc\DetectOverriddenAuthorizeAttribute.cs (1)
217DiagnosticDescriptors.OverriddenAuthorizeAttribute,
Mvc\MvcAnalyzer.cs (2)
25DiagnosticDescriptors.AmbiguousActionRoute, 26DiagnosticDescriptors.OverriddenAuthorizeAttribute
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (2)
19public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(DiagnosticDescriptors.DoNotUseNonLiteralSequenceNumbers); 46DiagnosticDescriptors.DoNotUseNonLiteralSequenceNumbers,
RouteEmbeddedLanguage\RoutePatternAnalyzer.cs (6)
23DiagnosticDescriptors.RoutePatternIssue, 24DiagnosticDescriptors.RoutePatternUnusedParameter 61DiagnosticDescriptors.RoutePatternIssue, 63DiagnosticDescriptors.RoutePatternIssue.DefaultSeverity, 104DiagnosticDescriptors.RoutePatternUnusedParameter, 106DiagnosticDescriptors.RoutePatternUnusedParameter.DefaultSeverity,
RouteHandlers\AtMostOneFromBodyAttribute.cs (1)
55DiagnosticDescriptors.AtMostOneFromBodyAttribute,
RouteHandlers\DetectAmbiguousRoutes.cs (1)
41DiagnosticDescriptors.AmbiguousRouteHandlerRoute,
RouteHandlers\DetectMismatchedParameterOptionality.cs (1)
37DiagnosticDescriptors.DetectMismatchedParameterOptionality,
RouteHandlers\DetectMisplacedLambdaAttribute.cs (1)
48DiagnosticDescriptors.DetectMisplacedLambdaAttribute,
RouteHandlers\DisallowMvcBindArgumentsOnParameters.cs (1)
39DiagnosticDescriptors.DoNotUseModelBindingAttributesOnRouteHandlerParameters,
RouteHandlers\DisallowNonParsableComplexTypesOnParameters.cs (2)
75DiagnosticDescriptors.RouteParameterComplexTypeIsNotParsable, 104DiagnosticDescriptors.RouteParameterComplexTypeIsNotParsable,
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (2)
48DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers, 82DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers,
RouteHandlers\RouteHandlerAnalyzer.cs (8)
24DiagnosticDescriptors.DoNotUseModelBindingAttributesOnRouteHandlerParameters, 25DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers, 26DiagnosticDescriptors.DetectMisplacedLambdaAttribute, 27DiagnosticDescriptors.DetectMismatchedParameterOptionality, 28DiagnosticDescriptors.RouteParameterComplexTypeIsNotParsable, 29DiagnosticDescriptors.BindAsyncSignatureMustReturnValueTaskOfT, 30DiagnosticDescriptors.AmbiguousRouteHandlerRoute, 31DiagnosticDescriptors.AtMostOneFromBodyAttribute
WebApplicationBuilder\PublicPartialProgramClassAnalyzer.cs (2)
16public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(DiagnosticDescriptors.PublicPartialProgramClassNotRequired); 28DiagnosticDescriptors.PublicPartialProgramClassNotRequired,
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (18)
22DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, 23DiagnosticDescriptors.DoNotUseConfigureWithConfigureWebHostBuilder, 24DiagnosticDescriptors.DoNotUseUseStartupWithConfigureWebHostBuilder, 25DiagnosticDescriptors.DoNotUseHostConfigureLogging, 26DiagnosticDescriptors.DoNotUseHostConfigureServices, 27DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder, 28DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints 89DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, 105DiagnosticDescriptors.DoNotUseConfigureWithConfigureWebHostBuilder, 121DiagnosticDescriptors.DoNotUseUseStartupWithConfigureWebHostBuilder, 137DiagnosticDescriptors.DoNotUseHostConfigureLogging, 153DiagnosticDescriptors.DoNotUseHostConfigureLogging, 169DiagnosticDescriptors.DoNotUseHostConfigureServices, 185DiagnosticDescriptors.DoNotUseHostConfigureServices, 201DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder, 217DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder, 233DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder, 251DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints,
Microsoft.AspNetCore.App.Analyzers.Test (250)
Authorization\AddAuthorizationBuilderTests.cs (11)
16var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 50var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 86var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 127var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 167var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 216var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 259var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 302var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 341var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 631var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder) 675var diagnostic = new DiagnosticResult(DiagnosticDescriptors.UseAddAuthorizationBuilder)
Components\DisallowNonLiteralSequenceNumbersTest.cs (3)
46Assert.Same(DiagnosticDescriptors.DoNotUseNonLiteralSequenceNumbers, diagnostic.Descriptor); 67Assert.Same(DiagnosticDescriptors.DoNotUseNonLiteralSequenceNumbers, diagnostic.Descriptor); 88Assert.Same(DiagnosticDescriptors.DoNotUseNonLiteralSequenceNumbers, diagnostic.Descriptor);
Http\HeaderDictionaryAddTest.cs (10)
28new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 49new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 52new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 73new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 164new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 183new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 204new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 207new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 228new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd) 249new DiagnosticResult(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd)
Http\HeaderDictionaryIndexerAnalyzerTests.cs (3)
32new DiagnosticResult(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer) 53new DiagnosticResult(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer) 151new DiagnosticResult(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer)
Http\HeaderDictionaryIndexerFixerTests.cs (5)
32new DiagnosticResult(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer) 68new DiagnosticResult(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer) 97new DiagnosticResult(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer) 122new DiagnosticResult(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer) 149new DiagnosticResult(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer)
Http\RequestDelegateReturnTypeAnalyzerTests.cs (10)
65new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 84new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 107new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 123new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 143new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 164new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 185new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 213new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 241new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate) 333new DiagnosticResult(DiagnosticDescriptors.DoNotReturnValueFromRequestDelegate)
Kestrel\ListenOnIPv6AnyAnalyzerAndFixerTests.cs (1)
54= new DiagnosticResult(DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny).WithLocation(0);
Mvc\DetectAmbiguousActionRoutesTest.cs (31)
35new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(0), 36new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(1) 94new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("[action]").WithLocation(0), 95new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("[action]").WithLocation(1) 127new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("[action]").WithLocation(0), 128new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("[action]").WithLocation(1) 251new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("{i}").WithLocation(0), 252new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("{i}").WithLocation(1) 372new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("{action}").WithLocation(0), 373new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("{action}").WithLocation(1) 405new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("{action}").WithLocation(0), 406new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("{action}").WithLocation(1) 529new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("{i}").WithLocation(0), 530new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("{i}").WithLocation(1) 632new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(0), 633new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(1), 634new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(2), 635new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/b").WithLocation(3), 636new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/b").WithLocation(4) 696new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(0), 697new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(1) 730new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(0), 731new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(1) 762new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(0), 763new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/a").WithLocation(1) 873new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/").WithLocation(0), 874new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("/").WithLocation(1) 938new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("Person").WithLocation(0), 939new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("Person").WithLocation(1) 971new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("Person").WithLocation(0), 972new DiagnosticResult(DiagnosticDescriptors.AmbiguousActionRoute).WithArguments("Person").WithLocation(1)
Mvc\DetectOverriddenAuthorizeAttributeTest.cs (25)
35new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyController").WithLocation(0) 73new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBase").WithLocation(0) 98new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBase").WithLocation(0), 99new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBase").WithLocation(1), 100new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBase").WithLocation(2) 122new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBase").WithLocation(0) 145new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBase").WithLocation(0) 182new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase").WithLocation(0), 183new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase").WithLocation(0) 212new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyController").WithLocation(0) 295new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyController.Get").WithLocation(0) 329new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyController").WithLocation(0) 352new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBase.Get").WithLocation(0) 427new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase.Get").WithLocation(0) 451new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBase.Get").WithLocation(0) 479new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase").WithLocation(0) 510new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase").WithLocation(0), 511new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase").WithLocation(1), 512new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase").WithLocation(2) 543new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase.Get").WithLocation(0), 544new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("MyControllerBaseBase.Get").WithLocation(1) 596new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("OAuthControllerAnon").WithLocation(0), 597new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("OAuthControllerAnon").WithLocation(1), 598new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("OAuthControllerMultiple").WithLocation(2), 599new DiagnosticResult(DiagnosticDescriptors.OverriddenAuthorizeAttribute).WithArguments("OAuthControllerInherited3").WithLocation(3)
RouteEmbeddedLanguage\RouteParameterUnusedParameterFixerTest.cs (23)
61var expectedDiagnostics = new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0); 117var expectedDiagnostics = new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0); 171var expectedDiagnostics = new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0); 227new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0), 228new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("bookId").WithLocation(1) 285new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0), 286new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("bookId").WithLocation(1) 343new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0), 344new DiagnosticResult(DiagnosticDescriptors.RoutePatternIssue).WithArguments("The route parameter name 'id' appears more than one time in the route template.").WithLocation(1), 385new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0) 430new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0) 471new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0) 512new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0) 553new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0) 594new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0) 635new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0) 676new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0) 719new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("bookId").WithLocation(0) 762new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0), 763new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id2").WithLocation(1), 764new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("bookId").WithLocation(2), 765new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("after").WithLocation(3), 832new DiagnosticResult(DiagnosticDescriptors.RoutePatternUnusedParameter).WithArguments("id").WithLocation(0),
RouteEmbeddedLanguage\RoutePatternAnalyzerTests.cs (11)
45Assert.Same(DiagnosticDescriptors.RoutePatternIssue, diagnostic.Descriptor); 77Assert.Same(DiagnosticDescriptors.RoutePatternIssue, diagnostic.Descriptor); 110Assert.Same(DiagnosticDescriptors.RoutePatternIssue, diagnostic.Descriptor); 138Assert.Same(DiagnosticDescriptors.RoutePatternIssue, diagnostic.Descriptor); 166Assert.Same(DiagnosticDescriptors.RoutePatternIssue, diagnostic.Descriptor); 195Assert.Same(DiagnosticDescriptors.RoutePatternIssue, diagnostic.Descriptor); 227Assert.Same(DiagnosticDescriptors.RoutePatternIssue, d.Descriptor); 232Assert.Same(DiagnosticDescriptors.RoutePatternIssue, d.Descriptor); 294Assert.Same(DiagnosticDescriptors.RoutePatternIssue, d.Descriptor); 334Assert.Same(DiagnosticDescriptors.RoutePatternUnusedParameter, d.Descriptor); 488Assert.Same(DiagnosticDescriptors.RoutePatternUnusedParameter, d.Descriptor);
RouteHandlers\AtMostOneFromBodyAttributeTest.cs (6)
66var expectedDiagnostic1 = new DiagnosticResult(DiagnosticDescriptors.AtMostOneFromBodyAttribute).WithLocation(0); 67var expectedDiagnostic2 = new DiagnosticResult(DiagnosticDescriptors.AtMostOneFromBodyAttribute).WithLocation(1); 99var expectedDiagnostic1 = new DiagnosticResult(DiagnosticDescriptors.AtMostOneFromBodyAttribute).WithLocation(0); 100var expectedDiagnostic2 = new DiagnosticResult(DiagnosticDescriptors.AtMostOneFromBodyAttribute).WithLocation(1); 135var expectedDiagnostic1 = new DiagnosticResult(DiagnosticDescriptors.AtMostOneFromBodyAttribute).WithLocation(0); 136var expectedDiagnostic2 = new DiagnosticResult(DiagnosticDescriptors.AtMostOneFromBodyAttribute).WithLocation(1);
RouteHandlers\DetectAmbiguousMappedRoutesTest.cs (20)
25new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 26new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 49new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 50new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 78new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 79new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 148new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 149new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 263new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 264new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 414new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 415new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 442new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 443new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 466new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 467new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 491new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 492new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1) 524new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(0), 525new DiagnosticResult(DiagnosticDescriptors.AmbiguousRouteHandlerRoute).WithArguments("/").WithLocation(1)
RouteHandlers\DetectMismatchedParameterOptionalityTest.cs (15)
30var expectedDiagnostics = new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("name").WithLocation(0); 53new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("name").WithLocation(0), 54new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("title").WithLocation(1) 78var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("name").WithLocation(0); 104new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("name").WithLocation(0), 105new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("title").WithLocation(1) 157new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("name").WithLocation(0), 158new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("title").WithLocation(1), 159new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("name").WithLocation(2), 160new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("title").WithLocation(3) 200new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("name").WithLocation(0), 201new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("title").WithLocation(1) 289var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("age").WithLocation(0); 313var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("age").WithLocation(0); 338var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DetectMismatchedParameterOptionality).WithArguments("age").WithLocation(0);
RouteHandlers\DetectMisplacedLambdaAttributeTest.cs (6)
48Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor); 70Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor); 96Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor); 102Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor); 129Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor); 218Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor);
RouteHandlers\DisallowMvcBindArgumentsOnParametersTest.cs (2)
61Assert.Same(DiagnosticDescriptors.DoNotUseModelBindingAttributesOnRouteHandlerParameters, diagnostic.Descriptor); 83Assert.Same(DiagnosticDescriptors.DoNotUseModelBindingAttributesOnRouteHandlerParameters, diagnostic.Descriptor);
RouteHandlers\DisallowNonParsableComplexTypesOnParametersTest.cs (5)
197var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.RouteParameterComplexTypeIsNotParsable) 220var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.RouteParameterComplexTypeIsNotParsable) 310var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.RouteParameterComplexTypeIsNotParsable) 446var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.RouteParameterComplexTypeIsNotParsable) 477var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.RouteParameterComplexTypeIsNotParsable)
RouteHandlers\DisallowReturningActionResultsFromMapMethodsTest.cs (6)
130Assert.Same(DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers, diagnostic.Descriptor); 153Assert.Same(DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers, diagnostic.Descriptor); 181Assert.Same(DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers, diagnostic.Descriptor); 213Assert.Same(DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers, diagnostic.Descriptor); 251Assert.Same(DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers, diagnostic.Descriptor); 289Assert.Same(DiagnosticDescriptors.DoNotReturnActionResultsFromRouteHandlers, diagnostic.Descriptor);
WebApplicationBuilder\DisallowConfigureAppConfigureHostBuilderTest.cs (9)
47var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureAppConfiguration").WithLocation(0); 70var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureHostConfiguration").WithLocation(0); 95var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureAppConfiguration").WithLocation(0); 130var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureAppConfiguration").WithLocation(0); 158new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureHostConfiguration").WithLocation(0), 159new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureAppConfiguration").WithLocation(1) 185var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureAppConfiguration").WithLocation(0); 207var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureAppConfiguration").WithLocation(0); 231var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder).WithArguments("ConfigureAppConfiguration").WithLocation(0);
WebApplicationBuilder\DisallowConfigureHostBuilderConfigureWebHostTest.cs (7)
45Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, diagnostic.Descriptor); 66Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, diagnostic.Descriptor); 88Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, diagnostic.Descriptor); 128Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, diagnostic.Descriptor); 156Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, diagnostic.Descriptor); 185Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, diagnostic.Descriptor); 219Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWebHostWithConfigureHostBuilder, diagnostic.Descriptor);
WebApplicationBuilder\DisallowConfigureHostLoggingTest.cs (11)
79var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0); 108var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0); 135var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0); 165var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0); 206var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0); 249var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0); 273Assert.Same(DiagnosticDescriptors.DoNotUseHostConfigureLogging, diagnostic.Descriptor); 303new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0), 304new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(1) 328var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0); 354var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureLogging).WithArguments("ConfigureLogging").WithLocation(0);
WebApplicationBuilder\DisallowConfigureServicesTest.cs (9)
54var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureServices).WithArguments("ConfigureServices").WithLocation(0); 81var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureServices).WithArguments("ConfigureServices").WithLocation(0); 109var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureServices).WithArguments("ConfigureServices").WithLocation(0); 137var expectedDiagnosis = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureServices).WithArguments("ConfigureServices").WithLocation(0); 204var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureServices).WithArguments("ConfigureServices").WithLocation(0); 245var expectedDiagnostic = new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureServices).WithArguments("ConfigureServices").WithLocation(0); 284Assert.Same(DiagnosticDescriptors.DoNotUseHostConfigureServices, diagnostic.Descriptor); 312new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureServices).WithArguments("ConfigureServices").WithLocation(0), 313new DiagnosticResult(DiagnosticDescriptors.DoNotUseHostConfigureServices).WithArguments("ConfigureServices").WithLocation(1)
WebApplicationBuilder\DisallowConfigureWebHostBuilderConfigureTest.cs (4)
47Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWithConfigureWebHostBuilder, diagnostic.Descriptor); 68Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWithConfigureWebHostBuilder, diagnostic.Descriptor); 95Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWithConfigureWebHostBuilder, diagnostic.Descriptor); 123Assert.Same(DiagnosticDescriptors.DoNotUseConfigureWithConfigureWebHostBuilder, diagnostic.Descriptor);
WebApplicationBuilder\DisallowConfigureWebHostBuilderUseStartupTest.cs (6)
46Assert.Same(DiagnosticDescriptors.DoNotUseUseStartupWithConfigureWebHostBuilder, diagnostic.Descriptor); 67Assert.Same(DiagnosticDescriptors.DoNotUseUseStartupWithConfigureWebHostBuilder, diagnostic.Descriptor); 87Assert.Same(DiagnosticDescriptors.DoNotUseUseStartupWithConfigureWebHostBuilder, diagnostic.Descriptor); 108Assert.Same(DiagnosticDescriptors.DoNotUseUseStartupWithConfigureWebHostBuilder, diagnostic.Descriptor); 135Assert.Same(DiagnosticDescriptors.DoNotUseUseStartupWithConfigureWebHostBuilder, diagnostic.Descriptor); 163Assert.Same(DiagnosticDescriptors.DoNotUseUseStartupWithConfigureWebHostBuilder, diagnostic.Descriptor);
WebApplicationBuilder\PublicPartialProgramClassTest.cs (2)
51var diagnostic = new DiagnosticResult(DiagnosticDescriptors.PublicPartialProgramClassNotRequired) 88var diagnostic = new DiagnosticResult(DiagnosticDescriptors.PublicPartialProgramClassNotRequired)
WebApplicationBuilder\UseTopLevelRouteRegistrationInsteadOfUseEndpointsTest.cs (9)
122Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic.Descriptor); 163Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic1.Descriptor); 167Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic2.Descriptor); 171Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic3.Descriptor); 175Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic2.Descriptor); 207Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic.Descriptor); 233Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic.Descriptor); 263Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic1.Descriptor); 267Assert.Same(DiagnosticDescriptors.UseTopLevelRouteRegistrationsInsteadOfUseEndpoints, diagnostic2.Descriptor);
Microsoft.AspNetCore.App.CodeFixes (18)
Authorization\AddAuthorizationBuilderFixer.cs (2)
23public override ImmutableArray<string> FixableDiagnosticIds { get; } = ImmutableArray.Create(DiagnosticDescriptors.UseAddAuthorizationBuilder.Id); 49equivalenceKey: DiagnosticDescriptors.UseAddAuthorizationBuilder.Id),
DetectMismatchedParameterOptionalityFixer.cs (2)
19public override ImmutableArray<string> FixableDiagnosticIds { get; } = ImmutableArray.Create(DiagnosticDescriptors.DetectMismatchedParameterOptionality.Id); 30equivalenceKey: DiagnosticDescriptors.DetectMismatchedParameterOptionality.Id),
Http\HeaderDictionaryAddFixer.cs (1)
24public override ImmutableArray<string> FixableDiagnosticIds { get; } = ImmutableArray.Create(DiagnosticDescriptors.DoNotUseIHeaderDictionaryAdd.Id);
Http\HeaderDictionaryIndexerFixer.cs (1)
19public override ImmutableArray<string> FixableDiagnosticIds { get; } = ImmutableArray.Create(DiagnosticDescriptors.UseHeaderDictionaryPropertiesInsteadOfIndexer.Id);
Kestrel\ListenOnIPv6AnyFixer.cs (2)
20public override ImmutableArray<string> FixableDiagnosticIds => [ DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny.Id ]; 73equivalenceKey: DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny.Id),
PublicPartialProgramClassFixer.cs (2)
19public override ImmutableArray<string> FixableDiagnosticIds { get; } = [DiagnosticDescriptors.PublicPartialProgramClassNotRequired.Id]; 47equivalenceKey: DiagnosticDescriptors.PublicPartialProgramClassNotRequired.Id),
RouteParameterUnusedParameterFixer.cs (2)
25DiagnosticDescriptors.RoutePatternUnusedParameter.Id); 52equivalenceKey: DiagnosticDescriptors.RoutePatternUnusedParameter.Id),
WebApplicationBuilderFixer.cs (6)
22DiagnosticDescriptors.DoNotUseHostConfigureLogging.Id, 23DiagnosticDescriptors.DoNotUseHostConfigureServices.Id, 24DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder.Id 46case string when id == DiagnosticDescriptors.DoNotUseHostConfigureLogging.Id: 51case string when id == DiagnosticDescriptors.DoNotUseHostConfigureServices.Id: 56case string when id == DiagnosticDescriptors.DisallowConfigureAppConfigureHostBuilder.Id: