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-for-managed-code-overview.md
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -36,11 +36,11 @@ To run code analysis manually on a project, from the menu bar choose **Analyze**
36
36
37
37
Code analysis rules for managed code are grouped into *rule sets*. You can use one of the Microsoft standard rule sets, or you can create a custom rule set to fulfill a specific need. For more information, see [Using Rule Sets to Group Code Analysis Rules](../code-quality/using-rule-sets-to-group-code-analysis-rules.md).
38
38
39
-
## In source suppression
39
+
## Suppress warnings
40
40
41
41
Frequently, it is useful to indicate that a warning is non-applicable. This informs the developer, and other people who might review the code later, that a warning was investigated and then either suppressed or ignored.
42
42
43
-
Insource suppression of warnings is implemented through custom attributes. To suppress a warning, add the attribute `SuppressMessage` to the source code as shown in the following example:
43
+
In-source suppression of warnings is implemented through custom attributes. To suppress a warning, add the attribute `SuppressMessage` to the source code as shown in the following example:
For more information, see [Suppress Warnings By Using the SuppressMessage Attribute](../code-quality/suppress-warnings-by-using-the-suppressmessage-attribute.md).
53
+
For more information, see [Suppress warnings](../code-quality/in-source-suppression-overview.md).
54
+
55
+
> [!NOTE]
56
+
> If you migrate a project to Visual Studio 2017, you might suddenly be faced with an overwhelming number of code analysis warnings. If you aren't ready to fix the warnings and want to temporarily turn code analysis off, open the project's property pages (**Project** > ***project* Properties...**) and go to the **Code Analysis** tab. Deselect **Enable Code Analysis on Build**, and then rebuild your project. Alternatively, you can select a different, smaller rule set to run against the code. Remember to turn code analysis back on when you are ready to fix the warnings.
Copy file name to clipboardExpand all lines: docs/code-quality/in-source-suppression-overview.md
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Suppressing code analysis warnings using the SuppressMessage attribute in Visual Studio | Microsoft Docs"
2
+
title: "Suppress code analysis warnings in Visual Studio | Microsoft Docs"
3
3
ms.custom: ""
4
4
ms.date: 01/29/2018
5
5
ms.reviewer: ""
@@ -30,6 +30,9 @@ In C++/CLI, use the macros CA\_SUPPRESS\_MESSAGE or CA\_GLOBAL\_SUPPRESS_MESSAGE
30
30
> [!NOTE]
31
31
> You should not use in-source suppressions on release builds, to prevent shipping the in-source suppression metadata accidentally. Additionally, because of the processing cost of in-source suppression, the performance of your application can be degraded.
32
32
33
+
> [!NOTE]
34
+
> If you migrate a project to Visual Studio 2017, you might suddenly be faced with an overwhelming number of code analysis warnings. If you aren't ready to fix the warnings and want to temporarily turn code analysis off, open the project's property pages (**Project** > ***project* Properties...**) and go to the **Code Analysis** tab. Deselect **Enable Code Analysis on Build**, and then rebuild your project. Alternatively, you can select a different, smaller rule set to run against the code. Remember to turn code analysis back on when you are ready to fix the warnings.
35
+
33
36
## SuppressMessage attribute
34
37
35
38
When you choose **Suppress** from the context or right-click menu of a code analysis warning in the **Error List**, a <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute is added either in your code or to the project's global suppression file.
@@ -90,7 +93,7 @@ For maintainability reasons, omitting the rule name is not recommended.
90
93
91
94
Suppression attributes can be applied to a method, but cannot be embedded within a method body. This means that all violations of a particular rule are suppressed if you add the <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute to the method.
92
95
93
-
In some cases, you might want to suppress a particular instance of the violation, for example so that future code isn't automatically exempt from the code analysis rule. Certain code analysis rules allow you to do this by using the `MessageId` property of the <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute. In general, legacy rules for violations on a particular symbol (a local variable or parameter) respect the `MessageId` property. [CA1500:VariableNamesShouldNotMatchFieldNames](../code-quality/ca1500-variable-names-should-not-match-field-names.md) is an example of such a rule. However, legacy rules for violations on executable code (non-symbol) do not respect the `MessageId` property. Additionally, Roslyn analyzers do not respect the `MessageId` property.
96
+
In some cases, you might want to suppress a particular instance of the violation, for example so that future code isn't automatically exempt from the code analysis rule. Certain code analysis rules allow you to do this by using the `MessageId` property of the <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute. In general, legacy rules for violations on a particular symbol (a local variable or parameter) respect the `MessageId` property. [CA1500:VariableNamesShouldNotMatchFieldNames](../code-quality/ca1500-variable-names-should-not-match-field-names.md) is an example of such a rule. However, legacy rules for violations on executable code (non-symbol) do not respect the `MessageId` property. Additionally, .NET Compiler Platform ("Roslyn") analyzers do not respect the `MessageId` property.
94
97
95
98
To suppress a particular symbol violation of a rule, specify the symbol name for the `MessageId` property of the <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute. The following example shows code with two violations of [CA1500:VariableNamesShouldNotMatchFieldNames](../code-quality/ca1500-variable-names-should-not-match-field-names.md)—one for the `name` variable and one for the `age` variable. Only the violation for the `age` symbol is suppressed.
Copy file name to clipboardExpand all lines: docs/code-quality/walkthrough-configuring-and-using-a-custom-rule-set.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -101,7 +101,7 @@ Now you can run Code Analysis on the RuleSetSample project and look for any erro
101
101
102
102
2. In the Error List window, click **Warnings** and then click the **Description** column header to sort the warnings alphanumerically.
103
103
104
-
In a real-world application, you would fix any rule violations worth fixing at this point, or optionally turn off or suppress a rule if you determined that it was not worth fixing. For more information, see [Suppress Warnings By Using the SuppressMessage Attribute](../code-quality/suppress-warnings-by-using-the-suppressmessage-attribute.md).
104
+
In a real-world application, you would fix any rule violations worth fixing at this point, or optionally turn off or suppress a rule if you determined that it was not worth fixing. For more information, see [Suppress warnings](../code-quality/in-source-suppression-overview.md).
105
105
106
106
3. NoticetheCA1704warnings. Theseviolationsonthisruleindicatethatyoushould" Consider providing a more meaningful name for the parameters."Youcouldcorrecttheissueinyourcodeoryoucandisabletherule, asexplainedinthenextprocedure.
Copy file name to clipboardExpand all lines: docs/ide/using-regular-expressions-in-visual-studio.md
+36-36Lines changed: 36 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -22,51 +22,51 @@ manager: ghogen
22
22
ms.workload:
23
23
- "multiple"
24
24
---
25
-
# Using Regular Expressions in Visual Studio
25
+
# Using regular expressions in Visual Studio
26
26
27
-
[!INCLUDE[vsprvs](../code-quality/includes/vsprvs_md.md)] uses .NET Framework regular expressions to find and replace text. For more information about .NET regular expressions, see [.NET Framework Regular Expressions](/dotnet/standard/base-types/regular-expressions).
28
-
29
-
> [!TIP]
30
-
> In Windows operating systems, most lines end in "\r\n" (a carriage return followed by a new line). These characters are not visible, but are present in the editor and are passed to the .NET Regular Expression service.
27
+
Visual Studio uses [.NET Framework regular expressions](/dotnet/standard/base-types/regular-expressions) to find and replace text.
31
28
32
29
## Replacement patterns
33
30
34
-
For information about regular expressions that are used in replacement patterns, see [Substitutions](/dotnet/standard/base-types/substitutions-in-regular-expressions). To use a numbered capture group, the syntax is `$1` to specify the numbered group, and `(x)` to specify the group in question. For example, the grouped regular expression `(\d)([a-z])` finds four matches in the following string: **1a 2b 3c 4d**. The replacement string `z$1` converts that string to **z1 z2 z3 z4**.
35
-
36
-
## Regular Expression examples
31
+
For information about regular expressions that are used in replacement patterns, see [Substitutions in regular expressions (.NET Guide)](/dotnet/standard/base-types/substitutions-in-regular-expressions). To use a numbered capture group, the syntax is `$1` to specify the numbered group, and `(x)` to specify the group in question. For example, the grouped regular expression `(\d)([a-z])` finds four matches in the following string: **1a 2b 3c 4d**. The replacement string `z$1` converts that string to **z1 z2 z3 z4**.
32
+
33
+
## Regular expression examples
37
34
38
35
Here are some examples:
39
36
40
37
|Purpose|Expression|Example|
41
38
|-------------|----------------|-------------|
42
-
|Match any single character (except a line break)|.|`a.o` matches "aro" in "around" and "abo" in "about" but not "acro" in "across".|
43
-
|Match zero or more occurrences of the preceding expression (match as many characters as possible)|*|`a*r` matches "r" in "rack", "ar" in "ark", and "aar" in "aardvark"|
44
-
|Match any character zero or more times (Wildcard *)|.*|c.*e matches "cke" in "racket", "comme" in "comment", and "code" in "code"|
45
-
|Match one or more occurrences of the preceding expression (match as many characters as possible)|+|`e.+e` matches "eede" in "feeder" but not "ee".|
46
-
|Match any character one or more times (Wildcard ?)|.+|e.+e matches "eede" in "feeder" but not "ee".|
47
-
|Match zero or more occurrences of the preceding expression (match as few characters as possible)|*?|`e.*?e` matches "ee" in "feeder" but not "eede".|
48
-
|Match one or more occurrences of the preceding expression (match as few characters as possible)|+?|`e.+?e` matches "ente" and "erprise" in "enterprise", but not the whole word "enterprise".|
49
-
|Anchor the match string to the beginning of a line or string|^|`^car` matches the word "car" only when it appears at the beginning of a line.|
50
-
|Anchor the match string to the end of a line|\r?$|`End\r?$` matches "end" only when it appears at the end of a line.|
51
-
|Match any single character in a set|[abc]|`b[abc]` matches "ba", "bb", and "bc".|
52
-
|Match any character in a range of characters|[a-f]|`be[n-t]` matches "bet" in "between", "ben" in "beneath", and "bes" in "beside", but not "below".|
53
-
|Capture and implicitly number the expression contained within parenthesis|()|`([a-z])X\1` matches "aXa"and "bXb", but not "aXb". ". "\1" refers to the first expression group "[a-z]".|
54
-
|Invalidate a match|(?!abc)|`real (?!ity)` matches "real" in "realty" and "really" but not in "reality." It also finds the second "real" (but not the first "real") in "realityreal".|
55
-
|Match any character that is not in a given set of characters|[^abc]|`be[^n-t]` matches "bef" in "before", "beh" in "behind", and "bel" in "below", but not "beneath".|
56
-
|Match either the expression before or the one after the symbol.|||`(sponge|mud) bath` matches "sponge bath" and "mud bath."|
57
-
|Escape the character following the backslash|\|`\^` matches the character ^.|
58
-
|Specify the number of occurrences of the preceding character or group|{x}, where x is the number of occurrences|`x(ab){2}x` matches "xababx", and `x(ab){2,3}x` matches "xababx" and "xabababx" but not "xababababx".|
59
-
|Match text in a Unicode character class, where "X" is the Unicode number. For more information about Unicode character classes, see<br /><br /> [Unicode Standard 5.2 Character Properties](http://www.unicode.org/versions/Unicode5.2.0/ch04.pdf).|\p{X}|`\p{Lu}` matches "T" and "D" in "Thomas Doe".|
60
-
|Match a word boundary|`\b` (Outside a character class \b specifies a word boundary, and inside a character class specifies a backspace).|`\bin` matches "in" in "inside" but not "pinto".|
61
-
|Match a line break (ie a carriage return followed by a new line).|\r?\n|`End\r?\nBegin` matches "End" and "Begin" only when "End" is the last string in a line and "Begin" is the first string in the next line.|
62
-
|Match any alphanumeric character|\w|`a\wd` matches "add" and "a1d" but not "a d".|
63
-
|Match any whitespace character.|(?([^\r\n])\s)|`Public\sInterface` matches the phrase "Public Interface".|
64
-
|Match any numeric character|\d|`\d` matches and "3" in "3456", "2" in 23", and "1" in "1".|
65
-
|Match a Unicode character|\uXXXX where XXXX specifies the Unicode character value.|`\u0065` matches the character "e".|
66
-
|Match an identifier|\b(_\w+|[\w-[0-9\_]]\w*)\b|Matches "type1" but not &type1" or "#define".|
67
-
|Match a string inside quotes|((\\".+?\\")|('.+?'))|Matches any string inside single or double quotes.|
68
-
|Match a hexadecimal number|\b0[xX]([0-9a-fA-F]\)\b|Matches "0xc67f" but not "0xc67fc67f".|
69
-
|Match integers and decimals|\b[0-9]*\\.\*[0-9]+\b|Matches "1.333".|
39
+
|Match any single character (except a line break)|.|`a.o` matches "aro" in "around" and "abo" in "about" but not "acro" in "across".|
40
+
|Match zero or more occurrences of the preceding expression (match as many characters as possible)|*|`a*r` matches "r" in "rack", "ar" in "ark", and "aar" in "aardvark"|
41
+
|Match any character zero or more times (Wildcard *)|.*|c.*e matches "cke" in "racket", "comme" in "comment", and "code" in "code"|
42
+
|Match one or more occurrences of the preceding expression (match as many characters as possible)|+|`e.+e` matches "eede" in "feeder" but not "ee".|
43
+
|Match any character one or more times (Wildcard ?)|.+|e.+e matches "eede" in "feeder" but not "ee".|
44
+
|Match zero or more occurrences of the preceding expression (match as few characters as possible)|*?|`e.*?e` matches "ee" in "feeder" but not "eede".|
45
+
|Match one or more occurrences of the preceding expression (match as few characters as possible)|+?|`e.+?e` matches "ente" and "erprise" in "enterprise", but not the whole word "enterprise".|
46
+
|Anchor the match string to the beginning of a line or string|^|`^car` matches the word "car" only when it appears at the beginning of a line.|
47
+
|Anchor the match string to the end of a line|\r?$|`End\r?$` matches "end" only when it appears at the end of a line.|
48
+
|Match any single character in a set|[abc]|`b[abc]` matches "ba", "bb", and "bc".|
49
+
|Match any character in a range of characters|[a-f]|`be[n-t]` matches "bet" in "between", "ben" in "beneath", and "bes" in "beside", but not "below".|
50
+
|Capture and implicitly number the expression contained within parenthesis|()|`([a-z])X\1` matches "aXa"and "bXb", but not "aXb". ". "\1" refers to the first expression group "[a-z]".|
51
+
|Invalidate a match|(?!abc)|`real (?!ity)` matches "real" in "realty" and "really" but not in "reality." It also finds the second "real" (but not the first "real") in "realityreal".|
52
+
|Match any character that is not in a given set of characters|[^abc]|`be[^n-t]` matches "bef" in "before", "beh" in "behind", and "bel" in "below", but not "beneath".|
53
+
|Match either the expression before or the one after the symbol.|||`(sponge|mud) bath` matches "sponge bath" and "mud bath."|
54
+
|Escape the character following the backslash|\\|`\^` matches the character ^.|
55
+
|Specify the number of occurrences of the preceding character or group|{x}, where x is the number of occurrences|`x(ab){2}x` matches "xababx", and `x(ab){2,3}x` matches "xababx" and "xabababx" but not "xababababx".|
56
+
|Match text in a Unicode character class, where "X" is the Unicode number. For more information about Unicode character classes, see<br /><br /> [Unicode Standard 5.2 Character Properties](http://www.unicode.org/versions/Unicode5.2.0/ch04.pdf).|\p{X}|`\p{Lu}` matches "T" and "D" in "Thomas Doe".|
57
+
|Match a word boundary|`\b` (Outside a character class \b specifies a word boundary, and inside a character class specifies a backspace).|`\bin` matches "in" in "inside" but not "pinto".|
58
+
|Match a line break (ie a carriage return followed by a new line).|\r?\n|`End\r?\nBegin` matches "End" and "Begin" only when "End" is the last string in a line and "Begin" is the first string in the next line.|
59
+
|Match any alphanumeric character|\w|`a\wd` matches "add" and "a1d" but not "a d".|
60
+
|Match any whitespace character.|(?([^\r\n])\s)|`Public\sInterface` matches the phrase "Public Interface".|
61
+
|Match any numeric character|\d|`\d` matches and "3" in "3456", "2" in 23", and "1" in "1".|
62
+
|Match a Unicode character|\uXXXX where XXXX specifies the Unicode character value.|`\u0065` matches the character "e".|
63
+
|Match an identifier|\b(_\w+|[\w-[0-9\_]]\w*)\b|Matches "type1" but not &type1" or "#define".|
64
+
|Match a string inside quotes|((\\".+?\\")|('.+?'))|Matches any string inside single or double quotes.|
65
+
|Match a hexadecimal number|\b0[xX]([0-9a-fA-F]\)\b|Matches "0xc67f" but not "0xc67fc67f".|
66
+
|Match integers and decimals|\b[0-9]*\\.\*[0-9]+\b|Matches "1.333".|
67
+
68
+
> [!TIP]
69
+
> In Windows operating systems, most lines end in "\r\n" (a carriage return followed by a new line). These characters are not visible, but are present in the editor and are passed to the .NET regular expression service.
Visual Studio has a deep understanding of your code via the Roslyn compiler to provide you with smart editing features like syntax colorization, code completion, spell-checking mistyped variables, unimported type resolution, outlining, structure visualizers, [CodeLens](find-code-changes-and-other-history-with-codelens.md), call hierarchy, hover-able quick info, parameter help, as well as tools for refactoring, applying quick actions, and generating code.
22
+
Visual Studio has a deep understanding of your code via the .NET ("Roslyn") compiler to provide you with smart editing features like syntax colorization, code completion, spell-checking mistyped variables, unimported type resolution, outlining, structure visualizers, [CodeLens](find-code-changes-and-other-history-with-codelens.md), call hierarchy, hover-able quick info, parameter help, as well as tools for refactoring, applying quick actions, and generating code.
23
23
24
24

Copy file name to clipboardExpand all lines: docs/ide/visual-studio-ide.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -258,7 +258,7 @@ You can view and manage your Azure-based cloud resources within Visual Studio us
258
258
259
259
If Visual Studio doesn't have the exact functionality you need, you can add it! You can personalize the IDE based on your workflow and style, add support for external tools not yet integrated with Visual Studio, and modify existing functionality to increase your productivity. To find the latest version of the Visual Studio Extensibility Tools (VS SDK), see [Visual Studio SDK](../extensibility/visual-studio-sdk.md).
260
260
261
-
You can use the .NET Compiler Platform (Roslyn) to write your own code analyzers and code generators. Find everything you need at [Roslyn](https://github.com/dotnet/Roslyn).
261
+
You can use the .NET Compiler Platform ("Roslyn") to write your own code analyzers and code generators. Find everything you need at [Roslyn](https://github.com/dotnet/Roslyn).
262
262
263
263
Find [existing extensions](https://marketplace.visualstudio.com/vs) for Visual Studio created by Microsoft developers as well as our development community.
Copy file name to clipboardExpand all lines: docs/ide/visual-studio-performance-tips-and-tricks.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ Some tools or extensions may to turned off to improve performance.
81
81
82
82
### Managed Language Services (Roslyn)
83
83
84
-
For information about Roslyn performance considerations, see [Performance considerations for large solutions] (https://github.com/dotnet/roslyn/wiki/Performance-considerations-for-large-solutions).
84
+
For information about .NET Compiler Platform ("Roslyn") performance considerations, see [Performance considerations for large solutions] (https://github.com/dotnet/roslyn/wiki/Performance-considerations-for-large-solutions).
0 commit comments