Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
.NET compiler platform analyzers inspect application code for code quality and style issues.
This article provides links to specific diagnostic messages for ASP.NET Core. For more information on .NET diagnostics, see Overview of .NET source code analysis.
Diagnostic codes
The following table lists the diagnostics available for ASP.NET Core applications.
Note
Not all diagnostics are available in older versions of ASP.NET Core.
| Diagnostic ID | Message |
|---|---|
| ASP0000 | Don't call IServiceCollection.BuildServiceProvider in ConfigureServices |
| ASP0001 | Authorization middleware is incorrectly configured |
| ASP0003 | Don't use model binding attributes with route handlers |
| ASP0004 | Don't use action results with route handlers |
| ASP0005 | Don't place attribute on method called by route handler lambda |
| ASP0006 | Don't use nonliteral sequence numbers |
| ASP0007 | Route parameter and argument optionality is mismatched |
| ASP0008 | Don't use ConfigureWebHost with WebApplicationBuilder.Host |
| ASP0009 | Don't use Configure with WebApplicationBuilder.WebHost |
| ASP0010 | Don't use UseStartup with WebApplicationBuilder.WebHost |
| ASP0011 | Suggest using builder.Logging over Host.ConfigureLogging or WebHost.ConfigureLogging |
| ASP0012 | Suggest using builder.Services over Host.ConfigureServices or WebHost.ConfigureServices |
| ASP0013 | Suggest switching from using Configure methods to WebApplicationBuilder.Configuration |
| ASP0014 | Suggest using top level route registrations |
| ASP0015 | Suggest using IHeaderDictionary properties |
| ASP0016 | Don't return a value from RequestDelegate |
| ASP0017 | Invalid route pattern |
| ASP0018 | Unused route parameter |
| ASP0019 | Suggest using IHeaderDictionary.Append or the indexer |
| ASP0020 | Complex types referenced by route parameters must be parsable |
| ASP0021 | Return type of the BindAsync method must be ValueTask<T> |
| ASP0022 | Route conflict detected between route handlers (Minimal API apps) |
| ASP0023 | Route conflict detected between route handlers |
| ASP0024 | Route handler has multiple parameters with the [FromBody] attribute |
| ASP0025 | Use AddAuthorizationBuilder to register authorization services and construct policies |
| ASP0026 | [Authorize] is overridden by [AllowAnonymous] from "farther away" |
| ASP0027 | Unnecessary public Program class declaration |
| ASP0028 | Consider using IPAddress.IPv6Any instead of IPAddress.Any |
| BL0001 | Component parameter should have public setters |
| BL0002 | Component has multiple CaptureUnmatchedValues parameters |
| BL0003 | Component parameter with CaptureUnmatchedValues has the wrong type |
| BL0004 | Component parameter should be public |
| BL0005 | Component parameter shouldn't be set outside of its component |
| BL0006 | Don't use RenderTree types |
| BL0007 | Component parameter {0} should be auto property |
| BL0008 | Component parameters should be auto properties |
| MVC1000 | Use of IHtmlHelper.Partial should be avoided |
| MVC1001 | Filters can't be applied to page handler methods |
| MVC1002 | Route attribute can't be applied to page handler methods |
| MVC1003 | Route attributes can't be applied to page models |
| MVC1004 | Rename model bound parameter |
| MVC1005 | Can't use UseMvc with Endpoint Routing |
| MVC1006 | Methods containing Tag Helpers (TagHelpers) must be async and return Task |
Related content
ASP.NET Core