You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/code-quality/code-analysis-warnings-for-managed-code-by-checkid.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -306,7 +306,7 @@ The following table lists Code Analysis warnings for managed code by the CheckId
306
306
| CA1041 |[CA1041: Provide ObsoleteAttribute message](../code-quality/ca1041-provide-obsoleteattribute-message.md)| A type or member is marked by using a System.ObsoleteAttribute attribute that does not have its ObsoleteAttribute.Message property specified. When a type or member that is marked by using ObsoleteAttribute is compiled, the Message property of the attribute is displayed. This gives the user information about the obsolete type or member. |
307
307
| CA1043 |[CA1043: Use integral or string argument for indexers](../code-quality/ca1043-use-integral-or-string-argument-for-indexers.md)| Indexers (that is, indexed properties) should use integral or string types for the index. These types are typically used for indexing data structures and they increase the usability of the library. Use of the Object type should be restricted to those cases where the specific integral or string type cannot be specified at design time. |
308
308
| CA1044 |[CA1044: Properties should not be write only](../code-quality/ca1044-properties-should-not-be-write-only.md)| Although it is acceptable and often necessary to have a read-only property, the design guidelines prohibit the use of write-only properties. This is because letting a user set a value, and then preventing the user from viewing that value, does not provide any security. Also, without read access, the state of shared objects cannot be viewed, which limits their usefulness. |
309
-
| CA1045 |[CA1045: Do not pass types by reference](../code-quality/ca1045-do-not-pass-types-by-reference.md)| Passing types by reference (using out or ref) requires experience with pointers, understanding how value types and reference types differ, and handling methods that have multiple return values. Library architects who design for a general audience should not expect users to master working with out or ref parameters. |
309
+
| CA1045 |[CA1045: Do not pass types by reference](../code-quality/ca1045-do-not-pass-types-by-reference.md)| Passing types by reference (using out or ref) requires experience with pointers, understanding how value types and reference types differ, and handling methods that have multiple return values. Library architects who design for a general audience should not expect users to master working with `out` or `ref` parameters. |
310
310
| CA1046 |[CA1046: Do not overload operator equals on reference types](../code-quality/ca1046-do-not-overload-operator-equals-on-reference-types.md)| For reference types, the default implementation of the equality operator is almost always correct. By default, two references are equal only if they point to the same object. |
311
311
| CA1047 |[CA1047: Do not declare protected members in sealed types](../code-quality/ca1047-do-not-declare-protected-members-in-sealed-types.md)| Types declare protected members so that inheriting types can access or override the member. By definition, sealed types cannot be inherited, which means that protected methods on sealed types cannot be called. |
312
312
| CA1048 |[CA1048: Do not declare virtual members in sealed types](../code-quality/ca1048-do-not-declare-virtual-members-in-sealed-types.md)| Types declare methods as virtual so that inheriting types can override the implementation of the virtual method. By definition, a sealed type cannot be inherited. This makes a virtual method on a sealed type meaningless. |
@@ -328,7 +328,7 @@ The following table lists Code Analysis warnings for managed code by the CheckId
328
328
| CA1064 |[CA1064: Exceptions should be public](../code-quality/ca1064-exceptions-should-be-public.md)| An internal exception is visible only inside its own internal scope. After the exception falls outside the internal scope, only the base exception can be used to catch the exception. If the internal exception is inherited from <xref:System.Exception>, <xref:System.SystemException>, or <xref:System.ApplicationException>, the external code will not have sufficient information to know what to do with the exception. |
329
329
| CA1065 |[CA1065: Do not raise exceptions in unexpected locations](../code-quality/ca1065-do-not-raise-exceptions-in-unexpected-locations.md)| A method that is not expected to throw exceptions throws an exception. |
330
330
| CA1300 |[CA1300: Specify MessageBoxOptions](../code-quality/ca1300-specify-messageboxoptions.md)| To correctly display a message box for cultures that use a right-to-left reading order, the RightAlign and RtlReading members of the MessageBoxOptions enumeration must be passed to the Show method. |
331
-
| CA1301 |[CA1301: Avoid duplicate accelerators](../code-quality/ca1301-avoid-duplicate-accelerators.md)| An access key, also known as an accelerator, enables keyboard access to a control by using the ALT key. When multiple controls have duplicate access keys, the behavior of the access key is not welldefined. |
331
+
| CA1301 |[CA1301: Avoid duplicate accelerators](../code-quality/ca1301-avoid-duplicate-accelerators.md)| An access key, also known as an accelerator, enables keyboard access to a control by using the ALT key. When multiple controls have duplicate access keys, the behavior of the access key is not well-defined. |
332
332
| CA1302 |[CA1302: Do not hardcode locale specific strings](../code-quality/ca1302-do-not-hardcode-locale-specific-strings.md)| The System.Environment.SpecialFolder enumeration contains members that refer to special system folders. The locations of these folders can have different values on different operating systems; the user can change some of the locations; and the locations are localized. The Environment.GetFolderPath method returns the locations that are associated with the Environment.SpecialFolder enumeration, localized and appropriate for the currently running computer. |
333
333
| CA1303 |[CA1303: Do not pass literals as localized parameters](../code-quality/ca1303-do-not-pass-literals-as-localized-parameters.md)| An externally visible method passes a string literal as a parameter to a constructor or method in the .NET Framework class library, and that string should be localizable. |
334
334
| CA1304 |[CA1304: Specify CultureInfo](../code-quality/ca1304-specify-cultureinfo.md)| A method or constructor calls a member that has an overload that accepts a System.Globalization.CultureInfo parameter, and the method or constructor does not call the overload that takes the CultureInfo parameter. When a CultureInfo or System.IFormatProvider object is not supplied, the default value that is supplied by the overloaded member might not have the effect that you want in all locales. |
@@ -402,7 +402,7 @@ The following table lists Code Analysis warnings for managed code by the CheckId
402
402
| CA1821 |[CA1821: Remove empty finalizers](../code-quality/ca1821-remove-empty-finalizers.md)| Whenever you can, avoid finalizers because of the additional performance overhead that is involved in tracking object lifetime. An empty finalizer incurs added overhead and delivers no benefit. |
403
403
| CA1822 |[CA1822: Mark members as static](../code-quality/ca1822-mark-members-as-static.md)| Members that do not access instance data or call instance methods can be marked as static (Shared in [!INCLUDE[vbprvb](../code-quality/includes/vbprvb_md.md)]). After you mark the methods as static, the compiler will emit nonvirtual call sites to these members. This can give you a measurable performance gain for performance-sensitive code. |
404
404
| CA1823 |[CA1823: Avoid unused private fields](../code-quality/ca1823-avoid-unused-private-fields.md)| Private fields were detected that do not appear to be accessed in the assembly. |
405
-
| CA1824 |[CA1824: Mark assemblies with NeutralResourcesLanguageAttribute](../code-quality/ca1824-mark-assemblies-with-neutralresourceslanguageattribute.md)| The NeutralResourcesLanguage attribute informs the ResourceManager of the language that was used to display the resources of a neutral culture for an assembly. This improves lookup performance for the first resource that you load and can reduce your working set. |
405
+
| CA1824 |[CA1824: Mark assemblies with NeutralResourcesLanguageAttribute](../code-quality/ca1824-mark-assemblies-with-neutralresourceslanguageattribute.md)| The NeutralResourcesLanguage attribute informs the resource manager of the language that was used to display the resources of a neutral culture for an assembly. This improves lookup performance for the first resource that you load and can reduce your working set. |
406
406
| CA1900 |[CA1900: Value type fields should be portable](../code-quality/ca1900-value-type-fields-should-be-portable.md)| This rule checks that structures that are declared by using explicit layout will align correctly when marshaled to unmanaged code on 64-bit operating systems. |
407
407
| CA1901 |[CA1901: P/Invoke declarations should be portable](../code-quality/ca1901-p-invoke-declarations-should-be-portable.md)| This rule evaluates the size of each parameter and the return value of a P/Invoke, and verifies that the size of the parameter is correct when marshaled to unmanaged code on 32-bit and 64-bit operating systems. |
408
408
| CA1903 |[CA1903: Use only API from targeted framework](../code-quality/ca1903-use-only-api-from-targeted-framework.md)| A member or type is using a member or type that was introduced in a service pack that was not included together with the targeted framework of the project. |
Copy file name to clipboardExpand all lines: docs/code-quality/use-roslyn-analyzers.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@ You can change the severity of a rule from **Solution Explorer**, or within the
102
102
103
103
There are multiple ways to suppress rule violations:
104
104
105
-
- From the **Analyze** menu.
105
+
- From the **Analyze** menu
106
106
107
107
Select **Analyze** > **Run Code Analysis and Suppress Active Issues** on the menu bar to suppress all current violations. This is sometimes referred to as "baselining".
108
108
@@ -116,15 +116,15 @@ There are multiple ways to suppress rule violations:
116
116
117
117
- From the **code editor**
118
118
119
-
To suppress a violation from the code editor, place the cursor in the line of code with the violation and press **Ctrl**+**.** to open the **Quick Actions** menu. Select **Suppress CAxxxx** > **In Source/In Suppression File**.
119
+
To suppress a violation from the code editor, place the cursor in the line of code with the violation and press **Ctrl**+**.** to open the **Quick Actions** menu. Select **Suppress CAXXXX** > **in Source/in Suppression File**.
120
120
121
121

122
122
123
123
- From the **Error List**
124
124
125
125
You can suppress one or many diagnostics from the **Error List** by selecting the ones you want to suppress, and then right-clicking and selecting **Suppress** > **In Source/In Suppression File**.
126
126
127
-
- If you supress**In Source**, the **Preview Changes** dialog opens and shows a preview of the C# [#pragma warning](/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-pragma-warning) or Visual Basic [#Disable warning](/dotnet/visual-basic/language-reference/directives/directives) directive that's added to the source code.
127
+
- If you suppress**In Source**, the **Preview Changes** dialog opens and shows a preview of the C# [#pragma warning](/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-pragma-warning) or Visual Basic [#Disable warning](/dotnet/visual-basic/language-reference/directives/directives) directive that's added to the source code.
128
128
129
129

0 commit comments