API and Bug-fix Update
- Features (new diagnostics)
- SA1027 (TabsMustNotBeUsed)
- SA1028 (CodeMustNotContainTrailingWhitespace)
- SA1108 (BlockStatementsMustNotContainEmbeddedComments)
- SA1118 (ParameterMustNotSpanMultipleLines)
- SA1208 (SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives)
- SA1216 (UsingStaticDirectivesMustBePlacedAfterOtherUsingDirectives)
- SA1217 (UsingStaticDirectivesMustBeOrderedAlphabetically)
- SA1501 (StatementMustNotBeOnSingleLine)
- SA1502 (ElementMustNotBeOnSingleLine)
- SA1512 (SingleLineCommentsMustNotBeFollowedByBlankLine)
- SA1515 (SingleLineCommentsMustNotBePrecededByBlankLine)
- SA1519 (CurlyBrackets)
- SA1520 (UseCurlyBracketsConsistently)
- SA1651 (DoNotUsePlaceholderElements)
- Features (new code fixes for existing rules)
- SA1500 (CurlyBracketsForMultiLineStatementsMustNotShareLine)
- SA1609 (PropertyDocumentationMustHaveValue)
- SA1610 (PropertyDocumentationMustHaveValueText)
- SA1617 (VoidReturnValueMustNotBeDocumented)
- Features (alternative rules)
- SX1309 (FieldNamesMustBeginWithUnderscore)
- SX1309S (StaticFieldNamesMustBeginWithUnderscore)
- Bug fixes
- Fix application of
[ExportCodeFixProvider]
(#803) - Enable analysis for several files previously excluded for their name alone (#848, #849, #850, #851, #854)
- Allow
<autogenerated
as a trigger in a file header to skip file analysis (#833) - SA1005 (SingleLineCommentsMustBeginWithSingleSpace) (#715)
- SA1205 (PartialElementsMustDeclareAccess) (#792)
- SA1300 (ElementMustBeginWithUpperCaseLetter) (#771)
- SA1304 (NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter) (#574)
- SA1402 (FileMayOnlyContainASingleClass) (#773)
- SA1403 (FileMayOnlyContainASingleNamespace) (#774)
- SA1503 (CurlyBracketsMustNotBeOmitted) (#859)
- SA1509 (OpeningCurlyBracketsMustNotBePrecededByBlankLine) (#775)
- SA1513 (ClosingCurlyBracketMustBeFollowedByBlankLine) (#784)
- SA1642 code fix (#780)
- Fix application of
Analyzers
The following analyzers are enabled by default in this release (all with Warning severity by default).
ID | Title | Code Fix |
---|---|---|
SA1000 | Keywords must be spaced correctly | ✔ |
SA1001 | Commas must be spaced correctly | ✔ |
SA1002 | Semicolons must be spaced correctly | ✔ |
SA1005 | Single line comments must begin with single space | ✔ |
SA1006 | Preprocessor keywords must not be preceded by space | ✔ |
SA1007 | Operator keyword must be followed by space | ✔ |
SA1021 | Negative signs must be spaced correctly | ✔ |
SA1022 | Positive signs must be spaced correctly | ✔ |
SA1027 | Tabs must not be used | ✔ |
SA1028 | Code must not contain trailing whitespace | ✔ |
SA1100 | Do not prefix calls with base unless local implementation exists | ✔ |
SA1101 | Prefix local calls with this | ✔ |
SA1102 | Query clause must follow previous clause | |
SA1106 | Code must not contain empty statements | |
SA1108 | Block statements must not contain embedded comments | |
SA1110 | Opening parenthesis or bracket must be on declaration line | |
SA1111 | Closing parenthesis must be on line of last parameter | |
SA1112 | Closing parenthesis must be on line of opening parenthesis | |
SA1113 | Comma must be on the same line as previous parameter | |
SA1114 | Parameter list must follow declaration | |
SA1118 | Parameter must not span multiple lines | |
SA1119 | Statement must not use unnecessary parenthesis | ✔ |
SA1121 | Use built-in type alias | ✔ |
SA1122 | Use string.Empty for empty strings | ✔ |
SA1123 | Do not place regions within elements | ✔ |
SA1124 | Do not use regions | ✔ |
SA1125 | Use shorthand for nullable types | |
SA1201 | Elements must appear in the correct order | |
SA1205 | Partial elements must declare access | ✔ |
SA1212 | Property accessors must follow order | |
SA1213 | Event accessors must follow order | |
SA1216 | Using static directives must be placed after other using directives | |
SA1217 | Using static directives must be ordered alphabetically | |
SA1300 | Element must begin with upper-case letter | |
SA1301 | Element must begin with lower-case letter | |
SA1302 | Interface names must begin with I | ✔ |
SA1303 | Const field names must begin with upper-case letter | |
SA1304 | Non-private readonly fields must begin with upper-case letter | ✔ |
SA1306 | Field names must begin with lower-case letter | ✔ |
SA1307 | Accessible fields must begin with upper-case letter | ✔ |
SA1308 | Variable names must not be prefixed | ✔ |
SA1309 | Field names must not begin with underscore | ✔ |
SA1310 | Field names must not contain underscore | ✔ |
SA1311 | Static readonly fields must begin with upper-case letter | ✔ |
SA1400 | Access modifier must be declared | ✔ |
SA1401 | Fields must be private | |
SA1402 | File may only contain a single class | |
SA1403 | File may only contain a single namespace | |
SA1404 | Code analysis suppression must have justification | |
SA1405 | Debug.Assert must provide message text | |
SA1406 | Debug.Fail must provide message text | |
SA1407 | Arithmetic expressions must declare precedence | ✔ |
SA1408 | Conditional expressions must declare precedence | ✔ |
SA1410 | Remove delegate parenthesis when possible | ✔ |
SA1411 | Attribute constructor must not use unnecessary parenthesis | ✔ |
SA1500 | Curly brackets for multi-line statements must not share line | |
SA1501 | Statement must not be on a single line | ✔ |
SA1502 | Element must not be on a single line | ✔ |
SA1503 | Curly brackets must not be omitted | ✔ |
SA1504 | All accessors must be single-line or multi-line | |
SA1507 | Code must not contain multiple blank lines in a row | ✔ |
SA1509 | Opening curly brackets must not be preceded by blank line | ✔ |
SA1513 | Closing curly bracket must be followed by blank line | ✔ |
SA1516 | Elements must be separated by blank line | ✔ |
SA1517 | Code must not contain blank lines at start of file | ✔ |
SA1518 | Code must not contain blank lines at end of file | ✔ |
SA1600 | Elements must be documented | |
SA1601 | Partial elements must be documented | |
SA1602 | Enumeration items must be documented | |
SA1603 | Documentation must contain valid XML | |
SA1604 | Element documentation must have summary | |
SA1605 | Partial element documentation must have summary | |
SA1606 | Element documentation must have summary text | |
SA1607 | Partial element documentation must have summary text | |
SA1608 | Element documentation must not have default summary | |
SA1609 | Property documentation must have value | ✔ |
SA1610 | Property documentation must have value text | ✔ |
SA1611 | Element parameters must be documented | |
SA1612 | Element parameter documentation must match element parameters | |
SA1613 | Element parameter documentation must declare parameter name | |
SA1614 | Element parameter documentation must have text | |
SA1615 | Element return value must be documented | |
SA1616 | Element return value documentation must have text | |
SA1617 | Void return value must not be documented | ✔ |
SA1626 | Single-line comments must not use documentation style slashes | |
SA1642 | Constructor summary documentation must begin with standard text | ✔ |
SA1643 | Destructor summary documentation must begin with standard text | ✔ |
SA1651 | Do not use placeholder elements | ✔ |
Alternative Analyzers
The following analyzers are provided to implement "alternate configurations" to some of the reference rules above.
ID | Title | Code Fix |
---|---|---|
SX1309 | Field names must begin with underscore | ✔ |
SX1309S | Static field names must begin with underscore | ✔ |
Acknowledgements
Thank you goes to all of the following users, who contributed feedback, bug reports, code submissions, testing, and reviews which helped in this release. In alphabetical order by username. This list does not include people who contacted us through other channels, but your feedback is no less valuable so we thank you as well.