C#idiomatic C#
code-analysis471 pages

idiomatic C#

Code analysis

Microsoft’s own analyzer catalog. Every CA and IDE rule, what it wants, and how to configure it.

  1. Rule categories 10/04/2021
  2. Code quality rule configuration options 03/24/2026
  3. Code-style rule options 10/22/2025
  4. Configuration files for code analysis rules 07/07/2021
  5. Configuration options for code analysis 02/13/2026
  6. Overview of .NET source code analysis 11/05/2025
  7. Predefined configuration files 09/24/2020
  8. CA1000: Do not declare static members on generic types CA1000 03/11/2019 CSharp · VB
  9. CA1001: Types that own disposable fields should be disposable CA1001 12/18/2020 CSharp · VB
  10. CA1002: Do not expose generic lists CA1002 11/04/2016
  11. CA1003: Use generic event handler instances CA1003 03/11/2019 CSharp · VB
  12. CA1005: Avoid excessive parameters on generic types CA1005 06/11/2020 CSharp
  13. CA1008: Enums should have zero value CA1008 03/11/2019 CSharp · VB
  14. CA1010: Collections should implement generic interface CA1010 03/11/2019
  15. CA1012: Abstract types should not have public constructors CA1012 03/11/2019 CSharp · VB
  16. CA1014: Mark assemblies with CLSCompliantAttribute CA1014 11/04/2016 CSharp · VB
  17. CA1016: Mark assemblies with AssemblyVersionAttribute CA1016 11/04/2016 CSharp · VB
  18. CA1017: Mark assemblies with ComVisibleAttribute CA1017 11/04/2016 CSharp · VB
  19. CA1018: Mark attributes with AttributeUsageAttribute CA1018 11/04/2016 CSharp · VB
  20. CA1019: Define accessors for attribute arguments CA1019 11/04/2016 CSharp · VB
  21. CA1021: Avoid out parameters CA1021 11/04/2016
  22. CA1024: Use properties where appropriate CA1024 12/21/2020 CSharp · VB
  23. CA1027: Mark enums with FlagsAttribute CA1027 03/11/2019
  24. CA1028: Enum storage should be Int32 CA1028 03/11/2019 CSharp · VB
  25. CA1030: Use events where appropriate CA1030 03/11/2019 CSharp
  26. CA1031: Do not catch general exception types CA1031 11/04/2016 CSharp · VB
  27. CA1032: Implement standard exception constructors CA1032 11/04/2016
  28. CA1033: Interface methods should be callable by child types CA1033 11/04/2016
  29. CA1034: Nested types should not be visible CA1034 11/04/2016 CSharp · VB
  30. CA1036: Override methods on comparable types CA1036 03/11/2019 CSharp · VB
  31. CA1040: Avoid empty interfaces CA1040 03/11/2019 CSharp · VB
  32. CA1041: Provide ObsoleteAttribute message CA1041 03/11/2019 CSharp · VB
  33. CA1043: Use integral or string argument for indexers CA1043 03/11/2019 CSharp · VB
  34. CA1044: Properties should not be write only CA1044 03/11/2019 CSharp · VB
  35. CA1045: Do not pass types by reference CA1045 11/04/2016
  36. CA1046: Do not overload operator equals on reference types CA1046 11/04/2016
  37. CA1047: Do not declare protected members in sealed types CA1047 06/11/2020 CSharp · VB
  38. CA1050: Declare types in namespaces CA1050 11/04/2016 CSharp · VB
  39. CA1051: Do not declare visible instance fields CA1051 03/11/2019
  40. CA1052: Static holder types should be Static or NotInheritable CA1052 07/25/2019 CSharp · VB
  41. CA1053: Static holder types should not have default constructors CA1053 11/04/2016
  42. CA1054: URI parameters should not be strings CA1054 03/11/2019 CSharp · VB
  43. CA1055: URI return values should not be strings CA1055 03/11/2019 CSharp · VB
  44. CA1056: URI properties should not be strings CA1056 03/11/2019 CSharp · VB
  45. CA1058: Types should not extend certain base types CA1058 03/11/2019
  46. CA1060: Move P/Invokes to NativeMethods class CA1060 11/04/2016 CSharp · VB
  47. CA1061: Do not hide base class methods CA1061 11/04/2016
  48. CA1062: Validate arguments of public methods CA1062 12/18/2020 CSharp · VB
  49. CA1063: Implement IDisposable correctly CA1063 11/09/2022 CSharp
  50. CA1064: Exceptions should be public CA1064 11/04/2016
  51. CA1065: Do not raise exceptions in unexpected locations CA1065 11/04/2016
  52. CA1066: Implement IEquatable when overriding Equals CA1066 04/23/2020
  53. CA1067: Override Equals when implementing IEquatable CA1067 04/23/2020
  54. CA1068: CancellationToken parameters must come last CA1068 09/16/2019
  55. CA1069: Enums should not have duplicate values CA1069 09/16/2019
  56. CA1070: Do not declare event fields as virtual CA1070 04/30/2020
  57. CA1200: Avoid using cref tags with a prefix CA1200 09/16/2019
  58. CA1303: Do not pass literals as localized parameters CA1303 11/04/2016 CSharp · VB
  59. CA1304: Specify CultureInfo CA1304 06/30/2018
  60. CA1305: Specify IFormatProvider CA1305 07/17/2023 CSharp
  61. CA1307: Specify StringComparison for clarity CA1307 11/04/2016
  62. CA1308: Normalize strings to uppercase CA1308 11/04/2016
  63. CA1309: Use ordinal StringComparison CA1309 11/04/2016
  64. CA1310: Specify StringComparison for correctness CA1310 08/26/2020
  65. CA1311: Specify a culture or use an invariant version CA1311 11/16/2022 CSharp · VB
  66. CA1401: P/Invokes should not be visible CA1401 11/04/2016 CSharp · VB
  67. CA1416: Validate platform compatibility CA1416 09/20/2021
  68. CA1417: Do not use `OutAttribute` on string parameters for P/Invokes CA1417 07/20/2020
  69. CA1418: Validate platform compatibility CA1418 08/31/2021
  70. CA1419: Provide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle' CA1419 01/19/2022
  71. CA1420: Property, type, or attribute requires runtime marshalling CA1420 11/03/2022 CSharp · VB
  72. CA1421: Method uses runtime marshalling when DisableRuntimeMarshallingAttribute is applied CA1421 11/16/2022 CSharp · VB
  73. CA1422: Validate platform compatibility - obsoleted APIs CA1422 11/03/2022 CSharp · VB
  74. CA1501: Avoid excessive inheritance CA1501 11/09/2022 CSharp · VB
  75. CA1502: Avoid excessive complexity CA1502 11/09/2022 CSharp · VB
  76. CA1505: Avoid unmaintainable code CA1505 11/09/2022
  77. CA1506: Avoid excessive class coupling CA1506 11/09/2022
  78. CA1507: Use `nameof` in place of string CA1507 12/14/2023
  79. CA1508: Avoid dead conditional code CA1508 04/23/2020
  80. CA1509: Invalid entry in code metrics configuration file CA1509 09/10/2026
  81. CA1510: Use ArgumentNullException throw helper CA1510 11/16/2023
  82. CA1511: Use ArgumentException throw helper CA1511 11/16/2023
  83. CA1512: Use ArgumentOutOfRangeException throw helper CA1512 11/16/2023
  84. CA1513: Use ObjectDisposedException throw helper CA1513 11/16/2023
  85. CA1514: Avoid redundant length argument CA1514 09/23/2023
  86. CA1515: Consider making public types internal CA1515 06/04/2025
  87. CA1516: Use cross-platform intrinsics CA1516 07/09/2025
  88. CA1700: Do not name enum values 'Reserved' CA1700 11/04/2016 CSharp
  89. CA1707: Identifiers should not contain underscores CA1707 11/04/2016 CSharp
  90. CA1708: Identifiers should differ by more than case CA1708 12/08/2022
  91. CA1710: Identifiers should have correct suffix CA1710 06/11/2020
  92. CA1711: Identifiers should not have incorrect suffix CA1711 07/21/2020
  93. CA1712: Do not prefix enum values with type name CA1712 11/04/2016 CSharp · VB
  94. CA1713: Events should not have before or after prefix CA1713 11/04/2016 CSharp
  95. CA1714: Flags enums should have plural names CA1714 03/11/2019
  96. CA1715: Identifiers should have correct prefix CA1715 03/11/2019 CSharp · VB
  97. CA1716: Identifiers should not match keywords CA1716 03/11/2019 CSharp
  98. CA1717: Only FlagsAttribute enums should have plural names CA1717 03/11/2019
  99. CA1720: Identifiers should not contain type names CA1720 03/11/2019 CSharp
  100. CA1721: Property names should not match get methods CA1721 03/11/2019 CSharp · VB
  101. CA1724: Type names should not match namespaces CA1724 07/21/2020
  102. CA1725: Parameter names should match base declaration CA1725 03/11/2019 CSharp
  103. CA1727: Use PascalCase for named placeholders CA1727 01/19/2022 CSharp
  104. CA1801: Review unused parameters CA1801 06/24/2019
  105. CA1802: Use Literals Where Appropriate CA1802 03/11/2019 CSharp · VB
  106. CA1805: Do not initialize unnecessarily CA1805 06/29/2020
  107. CA1806: Do not ignore method results CA1806 10/30/2025 CSharp · VB
  108. CA1810: Initialize reference type static fields inline CA1810 11/04/2016 CSharp · VB
  109. CA1812: Avoid uninstantiated internal classes CA1812 05/19/2023
  110. CA1813: Avoid unsealed attributes CA1813 11/04/2016 CSharp · VB
  111. CA1814: Prefer jagged arrays over multidimensional CA1814 12/18/2020 CSharp · VB
  112. CA1815: Override equals and operator equals on value types CA1815 03/11/2019
  113. CA1816: Call GC.SuppressFinalize correctly CA1816 06/30/2018 CSharp · VB
  114. CA1819: Properties should not return arrays CA1819 03/11/2019 CSharp · VB
  115. CA1820: Test for empty strings using string length CA1820 11/04/2016
  116. CA1821: Remove empty finalizers CA1821 11/04/2016
  117. CA1822: Mark members as static CA1822 03/30/2026 CSharp
  118. CA1823: Avoid unused private fields CA1823 11/04/2016 CSharp
  119. CA1824: Mark assemblies with NeutralResourcesLanguageAttribute CA1824 12/14/2023
  120. CA1825: Avoid zero-length array allocations CA1825 11/09/2022
  121. CA1826: Use property instead of Linq Enumerable method CA1826 12/07/2022
  122. CA1827: Do not use Count()/LongCount() when Any() can be used CA1827 07/17/2023
  123. CA1828: Do not use CountAsync/LongCountAsync when AnyAsync can be used CA1828 04/24/2020
  124. CA1829: Use Length/Count property instead of Enumerable.Count method CA1829 04/24/2020
  125. CA1830: Prefer strongly-typed Append and Insert method overloads on StringBuilder CA1830 06/18/2020
  126. CA1831: Use AsSpan instead of Range-based indexers for string when appropriate CA1831 06/04/2020
  127. CA1832: Use AsSpan or AsMemory instead of Range-based indexers for getting ReadOnlySpan or ReadOnlyMemory portion of an array CA1832 06/04/2020
  128. CA1833: Use AsSpan or AsMemory instead of Range-based indexers for getting Span or Memory portion of an array CA1833 06/04/2020
  129. CA1834: Use StringBuilder.Append(char) for single character strings CA1834 08/04/2020
  130. CA1835: Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes CA1835 05/11/2020
  131. CA1836: Prefer IsEmpty over Count when available CA1836 06/09/2020
  132. CA1837: Use Environment.ProcessId instead of Process.GetCurrentProcess().Id CA1837 08/27/2020
  133. CA1838: Avoid `StringBuilder` parameters for P/Invokes CA1838 08/03/2020
  134. CA1839: Use Environment.ProcessPath instead of Process.GetCurrentProcess().MainModule.FileName CA1839 11/23/2021 CSharp · VB
  135. CA1840: Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId CA1840 11/23/2021 CSharp · VB
  136. CA1841: Prefer Dictionary Contains methods CA1841 04/21/2021
  137. CA1842: Do not use 'WhenAll' with a single task CA1842 01/19/2022
  138. CA1843: Do not use 'WaitAll' with a single task CA1843 01/19/2022
  139. CA1844: Provide memory-based overrides of async methods when subclassing 'Stream' CA1844 05/18/2021 CSharp
  140. CA1845: Use span-based 'string.Concat' CA1845 05/18/2021
  141. CA1846: Prefer `AsSpan` over `Substring` CA1846 05/21/2021 CSharp · VB
  142. CA1847: Use String.Contains(char) instead of String.Contains(string) with single characters CA1847 03/03/2021 CSharp · VB
  143. CA1848: Use the LoggerMessage delegates CA1848 08/04/2025
  144. CA1849: Call async methods when in an async method CA1849 08/27/2021
  145. CA1850: Prefer static `HashData` method over `ComputeHash` CA1850 10/23/2021 CSharp · VB
  146. CA1851: Possible multiple enumerations of `IEnumerable` collection CA1851 09/01/2022 CSharp · VB
  147. CA1852: Seal internal types CA1852 05/19/2023 CSharp · VB
  148. CA1853: Unnecessary call to 'Dictionary.ContainsKey(key)' CA1853 11/16/2022 CSharp · VB
  149. CA1854: Prefer the `IDictionary.TryGetValue(TKey, out TValue)` method CA1854 06/01/2022 CSharp · VB
  150. CA1855: Use Span<T>.Clear() instead of Span<T>.Fill() CA1855 11/16/2022 CSharp
  151. CA1856: Incorrect usage of ConstantExpected attribute CA1856 11/15/2023 CSharp
  152. CA1857: The parameter expects a constant for optimal performance CA1857 11/15/2023 CSharp
  153. CA1858: Use StartsWith instead of IndexOf CA1858 12/20/2022 CSharp · VB
  154. CA1859: Use concrete types when possible for improved performance CA1859 05/01/2023
  155. CA1860: Avoid using 'Enumerable.Any()' extension method CA1860 07/17/2023
  156. CA1861: Avoid constant arrays as arguments CA1861 05/10/2023
  157. CA1862: Use the 'StringComparison' method overloads to perform case-insensitive string comparisons CA1862 11/21/2023
  158. CA1863: Use 'CompositeFormat' CA1863 11/20/2023
  159. CA1864: Prefer the 'IDictionary.TryAdd(TKey, TValue)' method CA1864 06/30/2023
  160. CA1865-CA1867: Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char CA1865-CA1867 07/27/2023
  161. CA1868: Unnecessary call to 'Contains' for sets CA1868 07/25/2023
  162. CA1869: Cache and reuse 'JsonSerializerOptions' instances CA1869 08/21/2023
  163. CA1870: Use a cached 'SearchValues' instance CA1870 09/12/2023
  164. CA1871: Do not pass a nullable struct to 'ArgumentNullException.ThrowIfNull' CA1871 02/25/2024
  165. CA1872: Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString' CA1872 03/21/2024
  166. CA1873: Avoid potentially expensive logging CA1873 10/27/2025
  167. CA1874: Use 'Regex.IsMatch' CA1874 10/27/2025
  168. CA1875: Use 'Regex.Count' CA1875 10/27/2025
  169. CA1877: Use 'Path.Combine' or 'Path.Join' overloads CA1877 11/05/2025
  170. CA1878: Prefer ReadOnlySpan properties over readonly array fields CA1878 08/24/2026
  171. CA2000: Dispose objects before losing scope CA2000 02/01/2025 CSharp · VB
  172. CA2002: Do not lock on objects with weak identity CA2002 01/31/2018 CSharp · VB
  173. CA2007: Do not directly await a Task CA2007 03/08/2019 CSharp
  174. CA2008: Do not create tasks without passing a TaskScheduler CA2008 08/26/2020 CSharp
  175. CA2009: Do not call ToImmutableCollection on an ImmutableCollection value CA2009 04/29/2020
  176. CA2011: Do not assign property within its setter CA2011 04/29/2020
  177. CA2012: Use ValueTasks correctly CA2012 06/18/2020 CSharp
  178. CA2013: Do not use ReferenceEquals with value types CA2013 05/27/2020
  179. CA2014: Do not use stackalloc in loops CA2014 06/18/2020 CSharp
  180. CA2015: Do not define finalizers for types derived from MemoryManager<T> CA2015 05/18/2020
  181. CA2016: Forward the CancellationToken parameter to methods that take one CA2016 06/18/2020
  182. CA2017: Parameter count mismatch CA2017 09/24/2025
  183. CA2018: The `count` argument to `Buffer.BlockCopy` should specify the number of bytes to copy CA2018 08/17/2021
  184. CA2019: `ThreadStatic` fields should not use inline initialization CA2019 11/04/2022 CSharp · VB
  185. CA2020: Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr CA2020 10/07/2022
  186. CA2021: Don't call Enumerable.Cast<T> or Enumerable.OfType<T> with incompatible types CA2021 11/16/2023 CSharp · VB
  187. CA2022: Avoid inexact read with Stream.Read CA2022 10/26/2024 CSharp · VB
  188. CA2023: Invalid braces in message template CA2023 10/27/2025
  189. CA2024: Do not use StreamReader.EndOfStream in async methods CA2024 01/16/2025 CSharp · VB
  190. CA2025: Do not pass 'IDisposable' instances into unawaited tasks CA2025 05/08/2025 CSharp
  191. CA2026: Prefer JsonElement.Parse over JsonDocument.Parse().RootElement CA2026 11/05/2025 CSharp · VB
  192. CA2100: Review SQL queries for security vulnerabilities CA2100 09/24/2025 CSharp · VB
  193. CA2101: Specify marshalling for P/Invoke string arguments CA2101 11/04/2016 CSharp · VB
  194. CA2109: Review visible event handlers CA2109 11/04/2016
  195. CA2119: Seal methods that satisfy private interfaces CA2119 11/04/2016 CSharp · VB
  196. CA2153: Avoid handling Corrupted State Exceptions CA2153 02/19/2019
  197. CA2200: Rethrow to preserve stack details CA2200 02/15/2023 CSharp · VB
  198. CA2201: Do not raise reserved exception types CA2201 11/04/2016 CSharp
  199. CA2207: Initialize value type static fields inline CA2207 11/04/2016 CSharp
  200. CA2208: Instantiate argument exceptions correctly CA2208 10/24/2025 CSharp · VB
  201. CA2211: Non-constant fields should not be visible CA2211 11/04/2016 CSharp · VB
  202. CA2213: Disposable fields should be disposed CA2213 05/14/2019
  203. CA2214: Do not call overridable methods in constructors CA2214 05/29/2016 CSharp · VB
  204. CA2215: Dispose methods should call base class dispose CA2215 11/04/2016 CSharp · VB
  205. CA2216: Disposable types should declare finalizer CA2216 11/04/2016
  206. CA2217: Do not mark enums with FlagsAttribute CA2217 03/11/2019 VB · CSharp
  207. CA2218: Override GetHashCode on overriding Equals CA2218 11/04/2016 VB
  208. CA2219: Do not raise exceptions in exception clauses CA2219 11/04/2016 CSharp
  209. CA2224: Override Equals() on overloading operator equals CA2224 11/04/2016
  210. CA2225: Operator overloads have named alternates CA2225 03/11/2019 CSharp
  211. CA2226: Operators should have symmetrical overloads CA2226 03/11/2019
  212. CA2227: Collection properties should be read only CA2227 03/30/2026 CSharp · VB
  213. CA2229: Implement serialization constructors CA2229 11/13/2023
  214. CA2231: Overload operator equals on overriding ValueType.Equals CA2231 03/11/2019 CSharp · VB
  215. CA2234: Pass System.Uri objects instead of strings CA2234 03/11/2019 CSharp · VB
  216. CA2235: Mark all non-serializable fields CA2235 11/04/2016 CSharp · VB
  217. CA2237: Mark ISerializable types with SerializableAttribute CA2237 11/04/2016 CSharp · VB
  218. CA2241: Provide correct arguments to formatting methods CA2241 05/28/2020 CSharp · VB
  219. CA2242: Test for NaN correctly CA2242 11/04/2016 CSharp · VB
  220. CA2243: Attribute string literals should parse correctly CA2243 11/04/2016
  221. CA2244: Do not duplicate indexed element initializations CA2244 04/30/2020
  222. CA2245: Do not assign a property to itself CA2245 04/29/2020
  223. CA2246: Do not assign a symbol and its member in the same statement CA2246 04/30/2020
  224. CA2247: Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum CA2247 05/16/2020
  225. CA2248: Provide correct enum argument to Enum.HasFlag CA2248 05/06/2020
  226. CA2249: Consider using String.Contains instead of String.IndexOf CA2249 08/27/2020
  227. CA2250: Use `ThrowIfCancellationRequested` CA2250 05/21/2021 CSharp · VB
  228. CA2251: Use `String.Equals` over `String.Compare` CA2251 05/31/2021
  229. CA2252: Opt in to preview features before using them CA2252 11/09/2022 CSharp
  230. CA2253: Named placeholders should not be numeric values CA2253 01/19/2022 CSharp
  231. CA2254: Template should be a static expression CA2254 11/30/2022
  232. CA2255: The `ModuleInitializer` attribute should not be used in libraries CA2255 11/15/2021
  233. CA2256: All members declared in parent interfaces must have an implementation in a DynamicInterfaceCastableImplementation-attributed interface CA2256 01/19/2022 CSharp
  234. CA2257: Members defined on an interface with the 'DynamicInterfaceCastableImplementationAttribute' should be 'static' CA2257 01/19/2022 CSharp
  235. CA2258: Providing a 'DynamicInterfaceCastableImplementation' interface in Visual Basic is unsupported CA2258 01/19/2022
  236. CA2259: Ensure `ThreadStatic` is only used with static fields CA2259 11/04/2022 CSharp · VB
  237. CA2260: Implement generic math interfaces correctly CA2260 10/06/2022
  238. CA2261: Do not use `ConfigureAwaitOptions.SuppressThrowing` with `Task<TResult>` CA2261 11/16/2023
  239. CA2262: Set 'MaxResponseHeadersLength' properly CA2262 01/30/2024
  240. CA2263: Prefer generic overload when type is known CA2263 02/18/2024
  241. CA2264: Do not pass a non-nullable value to 'ArgumentNullException.ThrowIfNull' CA2264 02/25/2024
  242. CA2265: Do not compare `Span<T>` to `null` or `default` CA2264 10/28/2024
  243. CA2266: File-based program entry point should start with `#!` CA2266 06/02/2026
  244. CA2267: Quote whitespace in file-based program directive values CA2267 08/21/2026
  245. CA2300: Do not use insecure deserializer BinaryFormatter CA2300 07/15/2020
  246. CA2301: Do not call BinaryFormatter.Deserialize without first setting BinaryFormatter.Binder CA2301 07/15/2020
  247. CA2302: Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize CA2302 07/15/2020
  248. CA2305: Do not use insecure deserializer LosFormatter CA2305 05/01/2019
  249. CA2310: Do not use insecure deserializer NetDataContractSerializer CA2310 05/01/2019
  250. CA2311: Do not deserialize without first setting NetDataContractSerializer.Binder CA2311 05/01/2019
  251. CA2312: Ensure NetDataContractSerializer.Binder is set before deserializing CA2312 05/01/2019
  252. CA2315: Do not use insecure deserializer ObjectStateFormatter CA2315 05/01/2019
  253. CA2321: Do not deserialize with JavaScriptSerializer using a SimpleTypeResolver CA2321 05/08/2019
  254. CA2322: Ensure JavaScriptSerializer is not initialized with SimpleTypeResolver before deserializing CA2322 05/08/2019
  255. CA2326: Do not use TypeNameHandling values other than None CA2326 08/20/2019
  256. CA2327: Do not use insecure JsonSerializerSettings CA2327 08/20/2019
  257. CA2328: Ensure that JsonSerializerSettings are secure CA2328 08/20/2019
  258. CA2329: Do not deserialize with JsonSerializer using an insecure configuration CA2329 08/20/2019
  259. CA2330: Ensure that JsonSerializer has a secure configuration when deserializing CA2330 08/20/2019
  260. CA2350: Ensure DataTable.ReadXml()'s input is trusted CA2350 07/14/2020
  261. CA2351: Ensure DataSet.ReadXml()'s input is trusted CA2351 08/11/2020
  262. CA2352: Unsafe DataSet or DataTable in serializable type can be vulnerable to remote code execution attacks CA2352 08/11/2020
  263. CA2353: Unsafe DataSet or DataTable in serializable type CA2353 07/14/2020
  264. CA2354: Unsafe DataSet or DataTable in deserialized object graph can be vulnerable to remote code execution attack CA2354 07/14/2020
  265. CA2355: Unsafe DataSet or DataTable in deserialized object graph CA2355 07/14/2020
  266. CA2356: Unsafe DataSet or DataTable type in web deserialized object graph CA2356 07/14/2020
  267. CA2361: Ensure autogenerated class containing DataSet.ReadXml() is not used with untrusted data CA2361 08/11/2020
  268. CA2362: Unsafe DataSet or DataTable in autogenerated serializable type can be vulnerable to remote code execution attacks CA2362 08/11/2020
  269. CA3001: Review code for SQL injection vulnerabilities CA3001 04/03/2019
  270. CA3002: Review code for XSS vulnerabilities CA3002 04/03/2019
  271. CA3003: Review code for file path injection vulnerabilities CA3003 04/03/2019
  272. CA3004: Review code for information disclosure vulnerabilities CA3004 04/03/2019
  273. CA3005: Review code for LDAP injection vulnerabilities CA3005 04/03/2019
  274. CA3006: Review code for process command injection vulnerabilities CA3006 04/03/2019
  275. CA3007: Review code for open redirect vulnerabilities CA3007 04/03/2019
  276. CA3008: Review code for XPath injection vulnerabilities CA3008 04/03/2019
  277. CA3009: Review code for XML injection vulnerabilities CA3009 07/19/2023
  278. CA3010: Review code for XAML injection vulnerabilities CA3010 04/03/2019
  279. CA3011: Review code for DLL injection vulnerabilities CA3011 04/03/2019
  280. CA3012: Review code for regex injection vulnerabilities CA3012 04/03/2019
  281. CA3061: Do not add schema by URL CA3061 08/14/2019
  282. CA3075: Insecure DTD Processing CA3075 03/18/2019
  283. CA3076: Insecure XSLT Script Execution CA3076 11/04/2016
  284. CA3077: Insecure Processing in API Design, XML Document and XML Text Reader CA3077 11/04/2016
  285. CA3147: Mark verb handlers with ValidateAntiForgeryToken CA3147 08/08/2018
  286. CA5350: Do Not Use Weak Cryptographic Algorithms CA5350 11/04/2016
  287. CA5351: Do Not Use Broken Cryptographic Algorithms CA5351 11/04/2016
  288. CA5358: Do Not Use Unsafe Cipher Modes CA5358 01/07/2020
  289. CA5359: Do not disable certificate validation CA5359 05/07/2020
  290. CA5360: Do not call dangerous methods in deserialization CA5360 05/27/2020
  291. CA5361: Do not disable SChannel use of strong crypto CA5361 07/12/2019
  292. CA5362: Potential reference cycle in deserialized object graph CA5362 07/29/2026
  293. CA5363: Do not disable request validation CA5363 08/14/2019
  294. CA5364: Do not use deprecated security protocols CA5364 07/12/2019
  295. CA5365: Do Not Disable HTTP Header Checking CA5365 04/29/2020
  296. CA5366: Use XmlReader For DataSet Read XML CA5366 04/30/2020
  297. CA5367: Do not serialize types with pointer fields CA5367 04/30/2020
  298. CA5368: Set ViewStateUserKey For Classes Derived From Page CA5368 05/07/2020
  299. CA5369: Use XmlReader for Deserialize CA5369 08/14/2019
  300. CA5370: Use XmlReader for validating reader CA5370 08/14/2019
  301. CA5371: Use XmlReader for schema read CA5371 08/14/2019
  302. CA5372: Use XmlReader for XPathDocument CA5372 08/14/2019
  303. CA5373: Do not use obsolete key derivation function CA5373 08/14/2019
  304. CA5374: Do not use XslTransform CA5374 04/28/2020
  305. CA5375: Do not use account shared access signature CA5375 05/19/2020
  306. CA5376: Use SharedAccessProtocol HttpsOnly CA5376 05/19/2020
  307. CA5377: Use container level access policy CA5377 05/19/2020
  308. CA5378: Do not disable ServicePointManagerSecurityProtocols CA5378 07/12/2019
  309. CA5379: Ensure key derivation function algorithm is sufficiently strong CA5379 05/07/2020
  310. CA5380: Do not add certificates to root store CA5380 08/14/2019
  311. CA5381: Ensure certificates are not added to root store CA5381 08/14/2019
  312. CA5382: Use secure cookies in ASP.NET Core CA5382 05/07/2020
  313. CA5383: Ensure use secure cookies in ASP.NET Core CA5383 05/07/2020
  314. CA5384: Do not use digital signature algorithm (DSA) CA5384 05/18/2020
  315. CA5385: Use Rivest–Shamir–Adleman (RSA) algorithm with sufficient key size CA5385 05/18/2020
  316. CA5386: Avoid hardcoding SecurityProtocolType value CA5386 07/12/2019
  317. CA5387: Do not use weak key derivation function with insufficient iteration count CA5387 05/08/2020
  318. CA5388: Ensure sufficient iteration count when using weak key derivation function CA5388 05/08/2020
  319. CA5389: Do not add archive item's path to the target file system path CA5389 08/14/2019
  320. CA5390: Do not hard-code encryption key CA5390 05/08/2020
  321. CA5391: Use antiforgery tokens in ASP.NET Core MVC controllers CA5391 05/27/2020
  322. CA5392: Use DefaultDllImportSearchPaths attribute for P/Invokes CA5392 05/28/2020
  323. CA5393: Do not use unsafe DllImportSearchPath value CA5393 05/28/2020
  324. CA5394: Do not use insecure randomness CA5394 05/08/2020
  325. CA5395: Miss HttpVerb attribute for action methods CA5395 05/27/2020
  326. CA5396: Set HttpOnly to true for HttpCookie CA5396 05/11/2020
  327. CA5397: Do not use deprecated SslProtocols values CA5397 08/14/2019
  328. CA5398: Avoid hardcoded SslProtocols values CA5398 08/14/2019
  329. CA5399: Enable HttpClient certificate revocation list check CA5399 05/18/2020
  330. CA5400: Ensure HttpClient certificate revocation list check is not disabled CA5400 05/18/2020
  331. CA5401: Do not use CreateEncryptor with non-default IV CA5401 05/13/2020
  332. CA5402: Use CreateEncryptor with the default IV CA5402 05/13/2020
  333. CA5403: Do not hard-code certificate CA5403 10/16/2019
  334. CA5404: Do not disable token validation checks CA5404 09/01/2021
  335. CA5405: Do not always skip token validation in delegates CA5405 09/01/2021
  336. Design rules 11/04/2016
  337. Documentation rules 09/16/2019
  338. Globalization rules 11/04/2016
  339. Code quality rules 01/31/2024
  340. Portability and interoperability rules 11/04/2016
  341. Maintainability rules 11/04/2016
  342. Naming rules 11/04/2016
  343. Performance rules 10/27/2025
  344. Reliability rules 10/27/2025
  345. Security rules 10/02/2019
  346. Usage rules 01/31/2024
  347. C# formatting options 01/30/2025 CSharp
  348. .NET formatting options 12/20/2022 CSharp · VB
  349. Simplify name (IDE0001) IDE0001 12/15/2023 CSharp · VB
  350. Simplify member access (IDE0002) IDE0002 09/30/2020 CSharp · VB
  351. Member-access qualification preferences (IDE0003 and IDE0009) IDE0003 03/24/2026 CSharp · VB
  352. Remove unnecessary cast (IDE0004) IDE0004 09/30/2020 CSharp · VB
  353. Remove unnecessary using directives (IDE0005) IDE0005 12/13/2023 CSharp · VB
  354. 'var' preferences (IDE0007 and IDE0008) IDE0007 09/30/2020 CSharp
  355. Add missing cases to switch statement (IDE0010) IDE0010 09/30/2020 CSharp · VB
  356. Add braces (IDE0011) IDE0011 09/30/2020 CSharp
  357. Use throw expression (IDE0016) IDE0016 09/30/2020 CSharp
  358. Use object initializers (IDE0017) IDE0017 09/30/2020 CSharp · VB
  359. Inline variable declaration (IDE0018) IDE0018 09/30/2020 CSharp
  360. Use pattern matching to avoid 'as' followed by a 'null' check (IDE0019) IDE0019 09/30/2020 CSharp
  361. Use pattern matching to avoid 'is' check followed by a cast (IDE0020 and IDE0038) IDE0020 09/30/2020 CSharp
  362. Use expression body for constructors (IDE0021) IDE0021 09/30/2020 CSharp
  363. Use expression body for methods (IDE0022) IDE0022 09/30/2020 CSharp
  364. Use expression body for operators (IDE0023 and IDE0024) IDE0023 09/30/2020 CSharp
  365. Use expression body for properties (IDE0025) IDE0025 09/30/2020 CSharp
  366. Use expression body for indexers (IDE0026) IDE0026 09/30/2020 CSharp
  367. Use expression body for accessors (IDE0027) IDE0027 09/30/2020 CSharp
  368. Use collection initializers or expressions (IDE0028) IDE0028 04/11/2025 CSharp · VB
  369. Null check can be simplified (IDE0029, IDE0030, and IDE0270) IDE0029 07/25/2023 CSharp · VB
  370. Use null propagation (IDE0031) IDE0031 09/30/2020 CSharp · VB
  371. Use auto-implemented property (IDE0032) IDE0032 09/30/2020 CSharp · VB
  372. Use explicitly provided tuple name (IDE0033) IDE0033 09/30/2020 CSharp · VB
  373. Simplify 'default' expression (IDE0034) IDE0034 09/30/2020 CSharp
  374. Remove unreachable code (IDE0035) IDE0035 09/30/2020 CSharp · VB
  375. Order modifiers (IDE0036) IDE0036 09/30/2020 CSharp · VB
  376. Use inferred member names (IDE0037) IDE0037 09/30/2020 CSharp · VB
  377. Use local function instead of lambda (IDE0039) IDE0039 09/30/2020 CSharp
  378. Add accessibility modifiers (IDE0040) IDE0040 09/30/2020 CSharp · VB
  379. Use 'is null' check (IDE0041) IDE0041 02/13/2023 CSharp · VB
  380. Deconstruct variable declaration (IDE0042) IDE0042 09/30/2020 CSharp
  381. Invalid format string (IDE0043) IDE0043 07/07/2026 CSharp · VB
  382. Add readonly modifier (IDE0044) IDE0044 09/30/2020 CSharp · VB
  383. Use conditional expression for assignment (IDE0045) IDE0045 09/30/2020 CSharp · VB
  384. Use conditional expression for return (IDE0046) IDE0046 09/30/2020 CSharp · VB
  385. Parentheses preferences (IDE0047 and IDE0048) IDE0047 09/30/2020 CSharp · VB
  386. Use language keywords instead of framework type names for type references (IDE0049) IDE0049 09/30/2020 CSharp · VB
  387. Convert anonymous type to tuple (IDE0050) IDE0050 09/30/2020 CSharp · VB
  388. Remove unused private member (IDE0051) IDE0051 09/30/2020 CSharp · VB
  389. Remove unread private member (IDE0052) IDE0052 09/30/2020 CSharp · VB
  390. Use expression body for lambdas (IDE0053) IDE0053 09/30/2020 CSharp
  391. Use compound assignment (IDE0054 and IDE0074) IDE0054 09/30/2020 CSharp · VB
  392. Formatting rule (IDE0055) IDE0055 06/13/2022 CSharp · VB
  393. Use index operator (IDE0056) IDE0056 09/30/2020 CSharp
  394. Use range operator (IDE0057) IDE0057 09/30/2020 CSharp
  395. Remove unnecessary expression value (IDE0058) IDE0058 09/30/2020 CSharp · VB
  396. Remove unnecessary value assignment (IDE0059) IDE0059 01/05/2026
  397. Remove unused parameter (IDE0060) IDE0060 09/30/2020 CSharp · VB
  398. Use expression body for local functions (IDE0061) IDE0061 09/30/2020 CSharp
  399. Make local function static (IDE0062) IDE0062 09/30/2020 CSharp
  400. Use simple 'using' statement (IDE0063) IDE0063 03/18/2022 CSharp
  401. Make struct fields writable (IDE0064) IDE0064 09/30/2020 CSharp
  402. 'using' directive placement (IDE0065) IDE0065 09/30/2020 CSharp
  403. Use switch expression (IDE0066) IDE0066 09/30/2020 CSharp
  404. Use 'System.HashCode.Combine' (IDE0070) IDE0070 04/10/2026 CSharp · VB
  405. Simplify interpolation (IDE0071) IDE0071 09/30/2020 CSharp · VB
  406. Add missing cases to switch expression (IDE0072) IDE0072 09/30/2020 CSharp
  407. Require file header (IDE0073) IDE0073 09/30/2020 CSharp · VB
  408. Simplify conditional expression (IDE0075) IDE0075 09/30/2020 CSharp · VB
  409. Remove invalid global 'SuppressMessageAttribute' (IDE0076) IDE0076 09/30/2020 CSharp · VB
  410. Avoid legacy format target in global 'SuppressMessageAttribute' (IDE0077) IDE0077 07/27/2021 CSharp
  411. Use pattern matching (IDE0078 and IDE0260) IDE0078 09/30/2020 CSharp
  412. Remove unnecessary suppression (IDE0079) IDE0079 12/27/2024 CSharp · VB
  413. Remove unnecessary suppression operator (IDE0080) IDE0080 09/30/2020 CSharp
  414. Remove `ByVal` (IDE0081) IDE0081 09/30/2020 VB
  415. Convert `typeof` to `nameof` (IDE0082) IDE0082 09/30/2020 CSharp · VB
  416. Use pattern matching (`not` operator) (IDE0083) IDE0083 09/30/2020 CSharp
  417. Use pattern matching (`IsNot` operator) (IDE0084) IDE0084 09/30/2020 VB
  418. Simplify `new` expression (IDE0090) IDE0090 09/30/2020 CSharp
  419. Remove unnecessary equality operator (IDE0100) IDE0100 09/30/2020 CSharp · VB
  420. Remove unnecessary discard (IDE0110) IDE0110 11/02/2020 CSharp
  421. Simplify LINQ expression (IDE0120) IDE0120 07/19/2023 CSharp
  422. Simplify LINQ type check and cast (IDE0121) IDE0121 03/25/2025 CSharp
  423. Namespace does not match folder structure (IDE0130) IDE0130 12/05/2022 CSharp · VB
  424. Simplify object creation (IDE0140) IDE0140 04/17/2021
  425. Prefer 'null' check over type check (IDE0150) IDE0150 06/29/2022
  426. Namespace declaration preferences (IDE0160 and IDE0161) IDE0160 06/28/2022 CSharp
  427. Simplify property pattern (IDE0170) IDE0170 06/29/2022
  428. Use tuple to swap values (IDE0180) IDE0180 06/29/2022
  429. Remove unnecessary lambda expression (IDE0200) IDE0200 07/19/2023 CSharp
  430. Convert to top-level statements (IDE0210) IDE0210 07/20/2023 CSharp
  431. Convert to 'Program.Main' style program (IDE0211) IDE0211 07/20/2023 CSharp
  432. Add explicit cast in foreach loop (IDE0220) IDE0220 07/20/2023 CSharp
  433. Add explicit cast (IDE0221) IDE0221 04/10/2026 CSharp
  434. Use UTF-8 string literal (IDE0230) IDE0230 07/20/2023 CSharp
  435. Nullable directive is redundant (IDE0240) IDE0240 07/24/2023 CSharp
  436. Nullable directive is unnecessary (IDE0241) IDE0241 07/24/2023 CSharp
  437. Struct can be made 'readonly' (IDE0250) IDE0250 07/24/2023 CSharp
  438. Member can be made 'readonly' (IDE0251) IDE0251 07/24/2023 CSharp
  439. Use 'nameof' (IDE0280) IDE0280 07/26/2023 CSharp
  440. Use primary constructor (IDE0290) IDE0290 11/10/2023 CSharp
  441. Use collection expression for array (IDE0300) IDE0300 01/18/2024 CSharp
  442. Use collection expression for empty (IDE0301) IDE0301 12/12/2023 CSharp
  443. Use collection expression for stackalloc (IDE0302) IDE0302 12/12/2023 CSharp
  444. Use collection expression for `Create()` (IDE0303) IDE0303 12/12/2023 CSharp
  445. Use collection expression for builder (IDE0304) IDE0304 12/12/2023 CSharp
  446. Use collection expression for fluent (IDE0305) IDE0305 12/12/2023 CSharp
  447. Use collection expression for new (IDE0306) IDE0306 03/25/2025 CSharp
  448. Make anonymous function static (IDE0320) IDE0320 11/08/2024 CSharp
  449. Prefer 'System.Threading.Lock' (IDE0330) IDE0330 11/08/2024 CSharp
  450. Use unbound generic type (IDE0340) IDE0340 03/25/2025 CSharp
  451. Use implicitly typed lambda (IDE0350) IDE0350 03/25/2025 CSharp
  452. Simplify property accessor (IDE0360) IDE0360 11/08/2025 CSharp
  453. Remove unnecessary suppression (IDE0370) IDE0370 11/08/2025 CSharp
  454. Remove unnecessary `unsafe` modifier (IDE0380) IDE0380 11/08/2025 CSharp
  455. Make method synchronous (IDE0390 and IDE0391) IDE0390, IDE0391 07/07/2026 CSharp
  456. Use labeled jump statement (IDE0410) IDE0410 07/09/2026 CSharp
  457. Use conditional delegate call (IDE1005) IDE1005 09/30/2020 CSharp
  458. The name does not exist in the current context (IDE1007) IDE1007 07/07/2026 CSharp
  459. Avoid multiple blank lines (IDE2000) IDE2000 08/19/2025 CSharp
  460. Embedded statements must be on their own line (IDE2001) IDE2001 08/19/2025 CSharp · VB
  461. Consecutive braces must not have blank line between them (IDE2002) IDE2002 08/19/2025 CSharp
  462. Blank line required between block and subsequent statement (IDE2003) IDE2003 08/19/2025 CSharp
  463. Blank line not allowed after constructor initializer colon (IDE2004) IDE2004 08/19/2025 CSharp
  464. Blank line not allowed after conditional expression token (IDE2005) IDE2005 08/19/2025 CSharp
  465. Blank line not allowed after arrow expression clause token (IDE2006) IDE2006 08/19/2025 CSharp
  466. Implement with Copilot (IDE3000) IDE3000 05/20/2025 CSharp
  467. Code-style rules 07/09/2026
  468. Language and unnecessary rules 07/09/2026
  469. Miscellaneous rules 02/06/2021
  470. Code-style naming rules 09/25/2020 CSharp · VB
  471. How to suppress code analysis warnings 06/09/2022