Skip to content

Commit b63cbdb

Browse files
Merge pull request #12 from MicrosoftDocs/master
new stuff
2 parents aa65362 + fceeca5 commit b63cbdb

File tree

416 files changed

+2954
-3019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

416 files changed

+2954
-3019
lines changed

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.c text
7+
*.h text
8+
9+
# Declare files that will always have CRLF line endings on checkout.
10+
*.sln text eol=crlf
11+
12+
# Denote all files that are truly binary and should not be modified.
13+
*.png binary
14+
*.jpg binary

.openpublishing.publish.config.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@
8686
}
8787
],
8888
"notification_subscribers": [],
89+
"sync_notification_subscribers": [
90+
91+
],
8992
"branches_to_filter": [],
9093
"git_repository_url_open_to_public_contributors": "https://github.com/MicrosoftDocs/visualstudio-docs",
9194
"git_repository_branch_open_to_public_contributors": "master",
@@ -113,11 +116,7 @@
113116
]
114117
},
115118
"need_generate_pdf_url_template": true,
116-
"targets": {
117-
"Pdf": {
118-
"template_folder": "_themes.pdf"
119-
}
120-
},
119+
"targets": {},
121120
"need_generate_pdf": false,
122121
"need_generate_intellisense": false
123-
}
122+
}

.openpublishing.redirection.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,13 @@
10921092
},
10931093
{
10941094
"source_path": "docs/ide/not-in-toc/web-publish-options.md",
1095-
"redirect_url": "/visualstudio/deployment/deploying-applications-services-and-components-resources", "redirect_document_id": false
1095+
"redirect_url": "/visualstudio/deployment/deploying-applications-services-and-components-resources",
1096+
"redirect_document_id": false
1097+
},
1098+
{
1099+
"source_path": "docs/ide/not-in-toc/intellicode-faq.md",
1100+
"redirect_url": "/visualstudio/intellicode/faq",
1101+
"redirect_document_id": false
10961102
},
10971103
{
10981104
"source_path": "docs/ide/optimize-solution-loading-in-visual-studio.md",
@@ -5730,6 +5736,11 @@
57305736
"source_path": "mac/benefits-vsmac-over-xs.md",
57315737
"redirect_url": "/visualstudio/mac/",
57325738
"redirect_document_id": false
5739+
},
5740+
{
5741+
"source_path": "docs/cross-platform/overview-of-visual-studio-tools-for-unity.md",
5742+
"redirect_url": "/visualstudio/cross-platform/visual-studio-tools-for-unity",
5743+
"redirect_document_id": false
57335744
}
57345745

57355746
]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Analyzer rule sets
3+
ms.date: 07/20/2018
4+
ms.prod: visual-studio-dev15
5+
ms.technology: vs-ide-code-analysis
6+
ms.topic: conceptual
7+
helpviewer_keywords:
8+
- "analyzers, rule sets"
9+
- "rule sets for analyzers"
10+
author: gewarren
11+
ms.author: gewarren
12+
manager: douge
13+
ms.workload:
14+
- "multiple"
15+
---
16+
# Rule sets for Roslyn analyzers
17+
18+
Predefined rule sets are included with some NuGet analyzer packages. For example, the rule sets that are included with the [Microsoft.CodeAnalysis.FxCopAnalyzers NuGet analyzer package](https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers/) (starting in version 2.6.2) enable or disable rules based on their category, such as security, naming, or performance. Using rule sets makes it easy to quickly see only those rule violations that pertain to a particular category of rule.
19+
20+
If you're migrating from legacy "FxCop" static code analysis to Roslyn analyzers, these rule sets enable you to continue using the same rule configurations you used previously.
21+
22+
## Use analyzer rule sets
23+
24+
After you [install a NuGet analyzer package](install-roslyn-analyzers.md), locate the predefined rule set in its *rulesets* directory, for example *%USERPROFILE%\\.nuget\packages\microsoft.codequality.analyzers\<version>\rulesets*. From there, you can drag and drop, or copy and paste, one or more of the rulesets to your Visual Studio project in **Solution Explorer**.
25+
26+
To make a rule set the active rule set for analysis, right-click on the project in **Solution Explorer** and choose **Properties**. In the project property pages, select the **Code Analysis** tab. Under **Run this rule set**, select **Browse**, and then select the desired rule set that you copied to the project directory. Now you only see rule violations for those rules that are enabled in the selected rule set.
27+
28+
You can also [customize a predefined rule set](how-to-create-a-custom-rule-set.md#create-a-custom-rule-set) to your preference. For example, you can change the severity of one or more rules so that violations appear as errors or warnings in the **Error List**.
29+
30+
## Available rule sets
31+
32+
The predefined analyzer rule sets include three rulesets that affect all the rules in the package&mdash;one that enables them all, one that disables them all, and one that honors each rule's default severity and enablement settings:
33+
34+
- AllRulesEnabled.ruleset
35+
- AllRulesDisabled.ruleset
36+
- AllRulesDefault.ruleset
37+
38+
Additionally, there are two rule sets for each category of rules in the package, such as performance or security. One rule set enables all rules for the category, and one rule set honors the default severity and enablement settings for each rule in the category.
39+
40+
The [Microsoft.CodeAnalysis.FxCopAnalyzers NuGet analyzer package](https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers/) includes rule sets for the following categories, to match the rule sets available for legacy "FxCop" static code analysis:
41+
42+
- design
43+
- documentation
44+
- maintainability
45+
- naming
46+
- performance
47+
- reliability
48+
- security
49+
- usage
50+
51+
## See also
52+
53+
- [Overview of .NET Compiler Platform analyzers](roslyn-analyzers-overview.md)
54+
- [Install .NET Compiler Platform analyzers](install-roslyn-analyzers.md)
55+
- [Configure and use Roslyn analyzer rules](use-roslyn-analyzers.md)
56+
- [Use rule sets to group code analysis rules](using-rule-sets-to-group-code-analysis-rules.md)

docs/code-quality/ca0063.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,27 @@ ms.workload:
1414
- "multiple"
1515
---
1616
# CA0063
17+
1718
Failed to load rule set file or one of its dependent rule set files.
1819

19-
Failed to load rule set file or one of its dependent rule set files.
20+
Failed to load rule set file or one of its dependent rule set files.
2021

21-
The specified ruleset could not be found or one of the ruleset files included in your ruleset could not be found. Make sure that the all the rulesets included in your ruleset exist on disk and that the appropriate ruleset directories are being specified in your project through the **CodeAnalysisRuleSetDirectories** property of [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)].
22+
The specified rule set could not be found or one of the rule set files included in your rule set could not be found. Make sure that the all the rule sets included in your rule set exist on disk and that the appropriate rule set directories are being specified in your project through the **CodeAnalysisRuleSetDirectories** property of [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)].
2223

23-
To debug the error, examine your ruleset file in a text editor. To find the path to the ruleset file, right-click the project in Solution Explorer, click **Properties**, and then click **Code Analysis**. Make sure the ruleset file is selected in **Run this rule set**. The Path to the rule set is listed in the description field.
24+
To debug the error, examine your rule set file in a text editor. To find the path to the rule set file, right-click the project in Solution Explorer, click **Properties**, and then click **Code Analysis**. Make sure the rule set file is selected in **Run this rule set**. The Path to the rule set is listed in the description field.
2425

25-
Examine the **Path** attribute value all the **Include** elements. Include paths can use relative paths to the parent/current ruleset file, environment variables, and absolute paths. For example:
26+
Examine the **Path** attribute value all the **Include** elements. Include paths can use relative paths to the parent/current rule set file, environment variables, and absolute paths. For example:
2627

27-
```
28+
```xml
2829
<Include Path="%PUBLIC%\Documents\RuleSets\alldesign.ruleset" Action="Default" />
2930
<Include Path="..\alldesign.ruleset" Action="Default" />
3031
<Include Path="C:\Rulesets\alldesign.ruleset" Action="Default" />
3132
```
3233

33-
Inspect each of these include paths and verify they are all valid.
34+
Inspect each of these include paths and verify they are all valid.
3435

35-
In some cases, the location of a ruleset can be dependent on an [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] property. [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] properties cannot be referenced from a ruleset. To work around this issue, specify additional search paths in the **CodeAnalysisRuleSetDirectories** property of [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]. In this scenario, specify only the name of the ruleset in the **Path** attribute of the **Include** element.
36+
In some cases, the location of a rule set can be dependent on an [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] property. [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] properties cannot be referenced from a rule set. To work around this issue, specify additional search paths in the **CodeAnalysisRuleSetDirectories** property of [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)]. In this scenario, specify only the name of the rule set in the **Path** attribute of the **Include** element.
3637

3738
## See Also
38-
[Code Analysis Application Errors](../code-quality/code-analysis-application-errors.md)
39+
40+
- [Code Analysis Application Errors](../code-quality/code-analysis-application-errors.md)

docs/code-quality/ca0064.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ No analysis was performed because the specified rule set did not contain any FxC
1919

2020
This warning can occur in one of the following situations:
2121

22-
- If you encounter this warning in conjunction with CA0063 warnings, there was an a problem loading your ruleset file. For more information, see the [CA0063](ca0063.md) documentation.
22+
- If you encounter this warning in conjunction with CA0063 warnings, there was a problem loading your rule set file. For more information, see the [CA0063](ca0063.md) article.
2323

24-
- If you encounter this error in conjunction with CA0062 warnings, it most likely that Code Analysis was unable to find the assembly or assemblies that contain the rules specified by the ruleset. For more information, see the [CA0062](ca0062.md) documentation.
24+
- If you encounter this error in conjunction with CA0062 warnings, it most likely that code analysis was unable to find the assembly or assemblies that contain the rules specified by the rule set. For more information, see the [CA0062](ca0062.md) article.
2525

26-
- Otherwise, this warning usually occurs when your ruleset is empty or all of the rules enabled in a child rule set have been disabled. Use the Visual Studio [rule set editor](../code-quality/working-in-the-code-analysis-rule-set-editor.md) to enable some rules in your ruleset.
26+
- Otherwise, this warning usually occurs when your rule set is empty or all of the rules enabled in a child rule set are disabled. Use the Visual Studio [rule set editor](../code-quality/working-in-the-code-analysis-rule-set-editor.md) to enable some rules in your rule set.
2727

2828
## See also
2929

30-
- [Code Analysis Application Errors](../code-quality/code-analysis-application-errors.md)
30+
- [Code analysis application errors](../code-quality/code-analysis-application-errors.md)

docs/code-quality/ca1020-avoid-namespaces-with-few-types.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ms.workload:
1818
- "multiple"
1919
---
2020
# CA1020: Avoid namespaces with few types
21+
2122
|||
2223
|-|-|
2324
|TypeName|AvoidNamespacesWithFewTypes|
@@ -26,16 +27,20 @@ ms.workload:
2627
|Breaking Change|Breaking|
2728

2829
## Cause
29-
A namespace other than the global namespace contains fewer than five types.
30+
31+
A namespace other than the global namespace contains fewer than five types.
3032

3133
## Rule Description
32-
Make sure that each of your namespaces has a logical organization, and that a valid reason exists to put types in a sparsely populated namespace. Namespaces should contain types that are used together in most scenarios. When their applications are mutually exclusive, types should be located in separate namespaces. For example, the <xref:System.Web.UI> namespace contains types that are used in Web applications, and the <xref:System.Windows.Forms> namespace contains types that are used in [!INCLUDE[TLA#tla_mswin](../code-quality/includes/tlasharptla_mswin_md.md)]-based applications. Even though both namespaces have types that control aspects of the user interface, these types are not designed for use in the same application. Therefore, they are located in separate namespaces. Careful namespace organization can also be helpful because it increases the discoverability of a feature. By examining the namespace hierarchy, library consumers should be able to locate the types that implement a feature.
34+
35+
Make sure that each of your namespaces has a logical organization, and that a valid reason exists to put types in a sparsely populated namespace. Namespaces should contain types that are used together in most scenarios. When their applications are mutually exclusive, types should be located in separate namespaces. For example, the <xref:System.Web.UI> namespace contains types that are used in web applications, and the <xref:System.Windows.Forms> namespace contains types that are used in [!INCLUDE[TLA#tla_mswin](../code-quality/includes/tlasharptla_mswin_md.md)]-based applications. Even though both namespaces have types that control aspects of the user interface, these types are not designed for use in the same application. Therefore, they are located in separate namespaces. Careful namespace organization can also be helpful because it increases the discoverability of a feature. By examining the namespace hierarchy, library consumers should be able to locate the types that implement a feature.
3336

3437
> [!NOTE]
35-
> Design-time types and permissions should not be merged into other namespaces to comply with this guideline. These types belong in their own namespaces below your main namespace, and the namespaces should end in `.Design` and `.Permissions`, respectively.
38+
> Design-time types and permissions should not be merged into other namespaces to comply with this guideline. These types belong in their own namespaces below your main namespace, and the namespaces should end in `.Design` and `.Permissions`, respectively.
3639
3740
## How to Fix Violations
38-
To fix a violation of this rule, try to combine namespaces that contain just a few types into a single namespace.
41+
42+
To fix a violation of this rule, try to combine namespaces that contain just a few types into a single namespace.
3943

4044
## When to Suppress Warnings
41-
It is safe to suppress a warning from this rule when the namespace does not contain types that are used with the types in your other namespaces.
45+
46+
It is safe to suppress a warning from this rule when the namespace does not contain types that are used with the types in your other namespaces.

docs/code-quality/ca2001-avoid-calling-problematic-methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Avoid making unnecessary and potentially dangerous method calls. A violation of
3939
|<xref:System.GC.Collect%2A?displayProperty=fullName>|Calling GC.Collect can significantly affect application performance and is rarely necessary. For more information, see [Rico Mariani's Performance Tidbits](http://go.microsoft.com/fwlink/?LinkId=169256) blog entry on MSDN.|
4040
|<xref:System.Threading.Thread.Resume%2A?displayProperty=fullName><br /><br /> <xref:System.Threading.Thread.Suspend%2A?displayProperty=fullName>|Thread.Suspend and Thread.Resume have been deprecated because of their unpredictable behavior. Use other classes in the <xref:System.Threading> namespace, such as <xref:System.Threading.Monitor>, <xref:System.Threading.Mutex>, and <xref:System.Threading.Semaphore>, to synchronize threads or protect resources.|
4141
|<xref:System.Runtime.InteropServices.SafeHandle.DangerousGetHandle%2A?displayProperty=fullName>|The DangerousGetHandle method poses a security risk because it can return a handle that is not valid. See the <xref:System.Runtime.InteropServices.SafeHandle.DangerousAddRef%2A> and the <xref:System.Runtime.InteropServices.SafeHandle.DangerousRelease%2A> methods for more information about how to use the DangerousGetHandle method safely.|
42-
|<xref:System.Reflection.Assembly.LoadFrom%2A?displayProperty=fullName><br /><br /> <xref:System.Reflection.Assembly.LoadFile%2A?displayProperty=fullName><br /><br /> <xref:System.Reflection.Assembly.LoadWithPartialName%2A?displayProperty=fullName>|These methods can load assemblies from unexpected locations. For example, see Suzanne Cook's .NET CLR Notes blog posts [LoadFile vs. LoadFrom](http://go.microsoft.com/fwlink/?LinkId=164450) and [Choosing a Binding Context](http://go.microsoft.com/fwlink/?LinkId=164451) on the MSDN Web site for information about methods that load assemblies.|
42+
|<xref:System.Reflection.Assembly.LoadFrom%2A?displayProperty=fullName><br /><br /> <xref:System.Reflection.Assembly.LoadFile%2A?displayProperty=fullName><br /><br /> <xref:System.Reflection.Assembly.LoadWithPartialName%2A?displayProperty=fullName>|These methods can load assemblies from unexpected locations. For example, see Suzanne Cook's .NET CLR Notes blog posts [LoadFile vs. LoadFrom](http://go.microsoft.com/fwlink/?LinkId=164450) and [Choosing a Binding Context](http://go.microsoft.com/fwlink/?LinkId=164451) for information about methods that load assemblies.|
4343
|[CoSetProxyBlanket](http://go.microsoft.com/fwlink/?LinkID=169250) (Ole32)<br /><br /> [CoInitializeSecurity](http://go.microsoft.com/fwlink/?LinkId=169255) (Ole32)|By the time the user code starts executing in a managed process, it is too late to reliably call CoSetProxyBlanket. The common language runtime (CLR) takes initialization actions that may prevent the users P/Invoke from succeeding.<br /><br /> If you do have to call CoSetProxyBlanket for a managed application, we recommend that you start the process by using a native code (C++) executable, call CoSetProxyBlanket in the native code, and then start your managed code application in process. (Be sure to specify a runtime version number.)|
4444

4545
## How to fix violations

0 commit comments

Comments
 (0)