AspNetCore.Docs/aspnetcore/diagnostics/code-analysis.md

3.7 KiB

title author description monikerRange ms.author ms.date uid
Code analysis in ASP.NET Core apps rick-anderson Learn about source code analysis in ASP.NET Core >= aspnetcore-3.1 riande 12/17/2021 diagnostics/code-analysis

Code analysis in ASP.NET Core apps

.NET compiler platform analyzers inspect application code for code quality and style issues. This document lists only diagnostics for ASP.NET Core. For information on .NET diagnostics, see Overview of .NET source code analysis.

Diagnostic ID Breaking or non-breaking Description
ASP0000 Non-breaking Do not call 'IServiceCollection.BuildServiceProvider' in 'ConfigureServices'
ASP0001 Non-breaking Authorization middleware is incorrectly configured
ASP0003 Non-breaking Do not use model binding attributes with route handlers
ASP0004 Non-breaking Do not use action results with route handlers
ASP0005 Non-breaking Do not place attribute on method called by route handler lambda
ASP0006 Non-breaking Do not use non-literal sequence numbers
ASP0007 Non-breaking Route parameter and argument optionality is mismatched
BL0001 Breaking Component parameter should have public setters
BL0002 Non-breaking Component has multiple CaptureUnmatchedValues parameters
BL0003 Breaking Component parameter with CaptureUnmatchedValues has the wrong type
BL0004 Breaking Component parameter should be public
BL0005 Non-breaking Component parameter should not be set outside of its component
BL0006 Non-breaking Do not use RenderTree types
MVC1000 Non-breaking Use of IHtmlHelper.Partial should be avoided
MVC1001 Non-breaking Filters cannot be applied to page handler methods
MVC1002 Non-breaking Route attributes cannot be applied to page handler methods
MVC1003 Non-breaking Route attributes cannot be applied to page models
MVC1004 Breaking Rename model bound parameter
MVC1005 Non-breaking Cannot use UseMvc with Endpoint Routing
MVC1006 Breaking Methods containing TagHelpers must be async and return Task