Open
Description
This is an overarching issue to track analyzer warnings that are currently silenced. To fix a single warning:
- Remove the warning silence from
.editorconfig
- Run a build locally
- Fix any warnings that are emitted
- Create a pull request
- Link it to this issue
- Once merged check the relevant box below
Table of Contents
StyleCop.Analyzers
Microsoft.VisualStudio.Threading.Analyzers
Roslyn
- Introduced with .NET 6 migration
- Language rules
- Code quality rules
StyleCop.Analyzers
StyleCop.Analyzers
- SA1001
- Commas should not be preceded by whitespace
- refactor: fix SA1001 #204
- SA1005
- Single line comment should begin with a space
- refactor: fix SA1005 #205
- SA1101
- Prefix local calls with this
- Refactor: Fix warning SA1101 #236
- SA1105
- Single line comment should begin with a space
- refactor: fix SA1105 #206
- SA1008
- Opening parenthesis should not be followed by a space.
- Refactor: Fix SA1008 #212
- SA1009
- Closing parenthesis should not be followed by a space
- Refactor: fix SA1009 #210
- SA1011
- Closing square bracket should be followed by a space
- Refactor: fix SA1011 #211
- SA1012
- Opening brace should be preceded by a space
- Refactor: Fix SA1012, SA1013, SA1026 and SA1118 #213
- SA1013
- Closing brace should be preceded by a space
- Refactor: Fix SA1012, SA1013, SA1026 and SA1118 #213
- SA1026
- The keyword 'new' should not be followed by a space or a blank line
- Refactor: Fix SA1012, SA1013, SA1026 and SA1118 #213
- SA1108
- Block statements should not contain embedded comments
- Refactor: Fix warning SA1108 #237
- SA1114
- Parameter list should follow declaration
- Refactor: Fix warning SA1114 #238
- SA1117
- The parameters should all be placed on the same line or each parameter should be placed on its own line
- Refactor: Fix SA1117 #214
- SA1118
- The parameter spans multiple lines
- Refactor: Fix SA1012, SA1013, SA1026 and SA1118 #213
- SA1135
- Using directive for namespace '...' should be qualified
- refactor: fix SA1135 #225
- SA1137
- Elements should have the same indentation
- refactor: fix SA1137 #209
- SA1142
- Refer to tuple fields by name
Refactor: Fix warnings SA1201, SA1210, SA1200, SA1142 #239- Fix analyzer warnings: SA1142, SA1201 #308
- SA1200
- Using directive should appear within a namespace declaration
Refactor: Fix warnings SA1201, SA1210, SA1200, SA1142 #239- Fix some analyzer warnings #416
- SA1201
- A field should not follow a property
Refactor: Fix warnings SA1201, SA1210, SA1200, SA1142 #239- Fix analyzer warnings: SA1142, SA1201 #308
- SA1202
- Constant fields should appear before non-constant fields
- SA1203
- 'public' members should come before 'private' members
- Refactor: Fix SA1203 #264
- refactor: fix analyzer warnings #319
- SA1204
- Static members should appear before non-static members
- Refactor: Fix SA1204 #219
- SA1208
- Using directive for '...' should appear before directive for '...'
- refactor: fix SA1208 #218
- SA1210
- Using directives should be ordered alphabetically by the namespaces
- refactor: fix SA1210 #227
- SA1214
- Readonly fields should appear before non-readonly fields
- Refactor: Fix SA1214 #250
- SA1216
- Using static directives should be placed at the correct location
- refactor: fix SA1216 #265
- refactor: fix analyzer warnings #319
- SA1316
- Tuple element names should use correct casing
- refactor: fix analyzer warnings #319
- SA1401
- Field should be private
- refactor: fix analyzer warnings #319
- SA1413
- Use trailing comma in multi-line initializers
- Refactor: Fix SA1413 #249
- SA1414
- Tuple types in signatures should have element names
- SA1500
- Braces for multi-line statements should not share line
- refactor: fix SA1500 #223
- fix analyzer warnings: IDE0024, IDE0039, IDE0066, IDE0010, IDE0074, IDE0075, SA1500, SA1515, CA1827, IDE0044 #317
- SA1515
- Single-line comment should be preceded by blank line
- Refactor: Fix SA1515 #248
- fix analyzer warnings: IDE0024, IDE0039, IDE0066, IDE0010, IDE0074, IDE0075, SA1500, SA1515, CA1827, IDE0044 #317
- SA1518
- File is required to end with a single newline character
- refactor: fix SA1518 #208
- SA1600
- Elements should be documented
- SA1602
- Enumeration items should be documented
- SA1604
- Element documentation should have summary
- SA1611
- The documentation for parameter '...' is missing
- SA1614
- Element parameter documentation should have text
- SA1615
- Element return value should be documented
- SA1616
- Element return value documentation should have text
- SA1617
- Void return value should not be documented
- SA1629
- Documentation text should end with a period
- refactor: fix SA1629 #226
- SA1633
- The file header is missing or not located at the top of the file.
- SA1642
- Constructor summary documentation should begin with standard text
- SA1648
- inheritdoc should be used with inheriting class
- refactor: fix SA1648 #207
Microsoft.VisualStudio.Threading.Analyzers
- VSTHRD002
- Synchronously waiting on tasks or awaiters may cause deadlocks. Use await or JoinableTaskFactory.Run instead.
- VSTHRD103
- Result synchronously blocks. Use await instead.
- VSTHRD101
- Avoid using async lambda for a void returning delegate type, because any exceptions not handled by the delegate will crash the process
- VSTHRD104
- Expose an async version of this method that does not synchronously block. Then simplify this method to call that async method within a JoinableTaskFactory.Run delegate.
- VSTHRD111
- Add .ConfigureAwait(bool) to your await expressio
- VSTHRD200
- Use "Async" suffix in names of methods that return an awaitable type
- Fix some analyzer warnings #416
Roslyn
Introduced with .NET 6 migration
Language rules
- IDE0003
- Remove this or Me qualification
- IDE0004
- Cast is redundant
- fix IDE0031, IDE0042, IDE0018, IDE0017, IDE0004, IDE0007, IDE0016 #305
- IDE0005
- Using directive is unnecessary
- refactor: fix IDE0009, IDE0033, IDE0150, IDE0051, SA1028, IDE0005, IDE0041 #303
- IDE0007
- use 'var' instead of explicit type
- fix IDE0031, IDE0042, IDE0018, IDE0017, IDE0004, IDE0007, IDE0016 #305
- IDE0008
- 'var' preferences
- IDE0009
- Add 'this' or 'Me' qualification
- refactor: fix IDE0009, IDE0033, IDE0150, IDE0051, SA1028, IDE0005, IDE0041 #303
- IDE0010
- IDE0016
- Null check can be simplified
- fix IDE0031, IDE0042, IDE0018, IDE0017, IDE0004, IDE0007, IDE0016 #305
- IDE0017
- Object initialization can be simplified
- fix IDE0031, IDE0042, IDE0018, IDE0017, IDE0004, IDE0007, IDE0016 #305
- IDE0018
- Variable declaration can be inlined
- fix IDE0031, IDE0042, IDE0018, IDE0017, IDE0004, IDE0007, IDE0016 #305
- IDE0019
- Use pattern matching to avoid 'as' followed by a 'null' check
- fix: analyzer warnings IDE0019, IDE0021, IDE0037 #326
- IDE0021
- Use expression body for constructors
- fix: analyzer warnings IDE0019, IDE0021, IDE0037 #326
- IDE0022
- Use expression body for methods
- IDE0024
- Use expression body for operators
- fix analyzer warnings: IDE0024, IDE0039, IDE0066, IDE0010, IDE0074, IDE0075, SA1500, SA1515, CA1827, IDE0044 #317
- IDE0025
- Use expression body for properties
- IDE0031
- Null check can be simplified
- fix IDE0031, IDE0042, IDE0018, IDE0017, IDE0004, IDE0007, IDE0016 #305
- IDE0032
- Use auto property
- refactor: fix analyzer warnings #319
- IDE0033
- Prefer explicitly provided tuple element name
- refactor: fix IDE0009, IDE0033, IDE0150, IDE0051, SA1028, IDE0005, IDE0041 #303
- IDE0034
- Simplify 'default' expression
- IDE0036
- Order modifiers
- IDE0037
- Member name can be simplified
- fix: analyzer warnings IDE0019, IDE0021, IDE0037 #326
- IDE0039
- IDE0041
- IDE0042
- Variable declaration can be deconstructed
- fix IDE0031, IDE0042, IDE0018, IDE0017, IDE0004, IDE0007, IDE0016 #305
- IDE0044
- IDE0051
- Private member is unused
- refactor: fix IDE0009, IDE0033, IDE0150, IDE0051, SA1028, IDE0005, IDE0041 #303
- IDE0052
- Private member 'TabularStringFormat.totalWidth' can be removed as the value assigned to it is never read
- refactor: fix analyzer warnings #319
- IDE0054
- Use compound assignment
- refactor: fix analyzer warnings #319
- IDE0055
- Formatting rule
- fix: analyzer warnings IDE0019, IDE0021, IDE0037 #326
- IDE0057
- Substring can be simplified
- fix: analyzer warnings IDE0019, IDE0021, IDE0037 #326
- IDE0060
- Remove unused parameter
- IDE0065
- 'using' directive placement
- IDE0066
- IDE0071
- Interpolation can be simplified
- refactor: fix analyzer warnings #319
- IDE0074
- IDE0075
- Conditional expression can be simplified
- fix analyzer warnings: IDE0024, IDE0039, IDE0066, IDE0010, IDE0074, IDE0075, SA1500, SA1515, CA1827, IDE0044 #317
- IDE0078
- Use pattern matching (may change code meaning)
- IDE0083
- Use pattern matchin
- IDE0090
- Simplify new expression
- IDE0120
- Simplify LINQ
- refactor: fix analyzer warnings #319
- IDE0150
- Null check can be clarified
- refactor: fix IDE0009, IDE0033, IDE0150, IDE0051, SA1028, IDE0005, IDE0041 #303
- IDE0160 and IDE0161
- Namespace declaration preferences
- IDE0220
- N/A
- IDE1006
- Naming rule violation
Code quality rules
- CA1001
- Types that own disposable fields should be disposable
- CA1002
- Do not expose generic lists
- CA1014
- Mark assemblies with CLSCompliantAttribute
- CA1018
- Mark attributes with AttributeUsageAttribute
- Fix some analyzer warnings #416
- CA1024
- Use properties where appropriate
- CA1027
- Mark enums with FlagsAttribute
- CA1028
- Enum Storage should be Int32
- CA1031
- Do not catch general exception types
- CA1032
- Implement standard exception constructors
- Fix some analyzer warnings #416
- CA1033
- Interface methods should be callable by child types
- Fix some analyzer warnings #416
- CA1034
- Nested types should not be visible
- CA1036
- Override methods on comparable types
- CA1040
- Avoid empty interfaces
- Fix Analyzer warnings: CA1707, CA1300, CA1040 #337
- CA1051
- Do not declare visible instance fields
- CA1052
- Static holder types should be Static or NotInheritable
- Fix some analyzer warnings #416
- CA1054
- URI-like parameters should not be strings
- CA1056
- URI-like properties should not be strings
- CA1062
- Validate arguments of public methods
- CA1064
- Exceptions should be public
- CA1303
- Do not pass literals as localized parameters
- CA1304
- Specify CultureInfo
- CA1305
- Specify IFormatProvider
- CA1307
- Specify StringComparison for clarity
- CA1308
- Normalize strings to uppercase
- fix: CA1308 #335
- CA1309
- Use ordinal string comparison
- CA1310
- Specify StringComparison for correctness
- CA1401
- P/Invokes should not be visible
- Fix some analyzer warnings #416
- CA1508
- Avoid dead conditional code
- Fix some analyzer warnings #416
- CA1707
- Identifiers should not contain underscores
- Fix Analyzer warnings: CA1707, CA1300, CA1040 #337
- CA1711
- Identifiers should not have incorrect suffix
- CA1724
- Type names should not match namespaces
- CA1725
- Parameter names should match base declaration
- Fix some analyzer warnings #416
- CA1805
- Do not initialize unnecessarily
- Fix some analyzer warnings #416
- CA1806
- Do not ignore method results
- CA1813
- Avoid unsealed attributes
- Fix some analyzer warnings #416
- CA1819
- Properties should not return arrays
- CA1820
- Test for empty strings using string length
- CA1822
- Mark members as static
- CA1823
- Avoid unused private fields
- CA1824
- Mark assemblies with NeutralResourcesLanguageAttribute
- CA1825
- Avoid zero-length array allocations
- Fix some analyzer warnings #416
- CA1827
- Do not use Count() or LongCount() when Any() can be used
- fix analyzer warnings: IDE0024, IDE0039, IDE0066, IDE0010, IDE0074, IDE0075, SA1500, SA1515, CA1827, IDE0044 #317
- CA1836
- Prefer IsEmpty over Count
- Fix some analyzer warnings #416
- CA1829
- Use Length/Count property instead of Count() when available
- fix: CA1829, CA1834, CA1846, CA1847 #338
- CA1834
- Consider using 'StringBuilder.Append(char)' when applicable
- fix: CA1829, CA1834, CA1846, CA1847 #338
- CA1835
- Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync'
- Fix some analyzer warnings #416
- CA1837
- Use 'Environment.ProcessId'
- CA1838
- Avoid 'StringBuilder' parameters for P/Invokes
- Fix some analyzer warnings #416
- CA1846
- Prefer 'AsSpan' over 'Substring'
- fix: CA1829, CA1834, CA1846, CA1847 #338
- CA1847
- Use char literal for a single character lookup
- fix: CA1829, CA1834, CA1846, CA1847 #338
- CA1849
- Call async methods when in an async method
- CA2000
- Dispose objects before losing scope
- Fix some analyzer warnings #416
- CA2007
- Consider calling ConfigureAwait on the awaited task
- CA2016
- Forward the 'CancellationToken' parameter to methods
- Fix some analyzer warnings #416
- CA2101
- Specify marshaling for P/Invoke string arguments
- Fix some analyzer warnings #416
- CA2201
- Exception type System.Exception is not sufficiently specific
- Fix some analyzer warnings #416
- CA2208
- Instantiate argument exceptions correctly
- Fix some analyzer warnings #416
- CA2211
- Non-constant fields should not be visible
- CA2219
- Do not raise exceptions in finally clauses
- CA2234
- Pass system uri objects instead of strings
- Fix some analyzer warnings #416
- CA2251
- Use 'string.Equals'
- CA2227
- Collection properties should be read only
- CA2249
- Consider using 'string.Contains' instead of 'string.IndexOf'
- Fix some analyzer warnings #416
- CA5392
- Use DefaultDllImportSearchPaths attribute for P/Invokes
- Fix some analyzer warnings #416
StyleCop.Analyzers
- SA1028
- Code should not contain trailing whitespace
- refactor: fix IDE0009, IDE0033, IDE0150, IDE0051, SA1028, IDE0005, IDE0041 #303
- SA1101
- Prefix local calls with this
- SA1201
- Elements should appear in the correct order
- SA1202
- Elements should be ordered by access
- SA1500
- Braces for multi-line statements should not share line
- fix analyzer warnings: IDE0024, IDE0039, IDE0066, IDE0010, IDE0074, IDE0075, SA1500, SA1515, CA1827, IDE0044 #317
- SA1515
- Single-line comment should be preceded by blank line
- fix analyzer warnings: IDE0024, IDE0039, IDE0066, IDE0010, IDE0074, IDE0075, SA1500, SA1515, CA1827, IDE0044 #317
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
In progress