Skip to content

Commit b537936

Browse files
authored
Merge pull request #4939 from MicrosoftDocs/master637199760928234372
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents c2a98f2 + 92361aa commit b537936

File tree

44 files changed

+899
-97
lines changed

Some content is hidden

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

44 files changed

+899
-97
lines changed

.openpublishing.redirection.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11615,10 +11615,15 @@
1161511615
"redirect_url": "/visualstudio/subscriptions",
1161611616
"redirect_document_id": false
1161711617
},
11618+
{
11619+
"source_path": "docs/code-quality/how-to-enable-and-disable-full-solution-analysis-for-managed-code.md",
11620+
"redirect_url": "/visualstudio/code-quality/configure-live-code-analysis-scope-managed-code",
11621+
"redirect_document_id": true
11622+
},
1161811623
{
1161911624
"source_path": "docs/azure/cognitive-services-connected-services.yml",
1162011625
"redirect_url": "/visualstudio/azure",
1162111626
"redirect_document_id": false
1162211627
}
1162311628
]
11624-
}
11629+
}

docs/code-quality/automatic-feature-suspension.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ title: Automatic feature suspension
33
ms.date: 11/04/2016
44
ms.topic: conceptual
55
helpviewer_keywords:
6-
- full solution analysis
7-
- performance
8-
- low-memory
6+
- "live code analysis"
7+
- "background analysis"
8+
- "analysis scope"
9+
- "full solution analysis"
10+
- "performance"
11+
- "low-memory"
912
ms.assetid: 572c15aa-1fd0-468c-b6be-9fa50e170914
1013
author: TerryGLee
1114
ms.author: tglee
@@ -23,7 +26,7 @@ When Visual Studio detects a low memory condition, it automatically suspends cer
2326

2427
In a low memory condition, the following actions take place:
2528

26-
- Full solution analysis for Visual C# and Visual Basic is disabled.
29+
- Live code analysis for Visual C# and Visual Basic is reduced to minimal scope.
2730

2831
- [Garbage Collection](/dotnet/standard/garbage-collection/index) (GC) low-latency mode for Visual C# and Visual Basic is disabled.
2932

@@ -33,9 +36,9 @@ In a low memory condition, the following actions take place:
3336

3437
For tips and tricks on how to improve Visual Studio performance when dealing with large solutions or low-memory conditions, see [Performance considerations for large solutions](https://github.com/dotnet/roslyn/wiki/Performance-considerations-for-large-solutions).
3538

36-
## Full solution analysis suspended
39+
## Live code analysis is reduced to minimal scope
3740

38-
By default, full solution analysis is enabled for Visual Basic and disabled for Visual C#. However, in a low memory condition, full solution analysis is automatically disabled for both Visual Basic and Visual C#, regardless of their settings in the Options dialog box. However, you can re-enable full solution analysis by choosing the **Re-enable** button in the info bar when it appears, by selecting the **Enable full solution analysis** check box in the Options dialog, or by restarting Visual Studio. The Options dialog box always shows the current full solution analysis settings. For more information, see [How to: Enable and Disable Full Solution Analysis](../code-quality/how-to-enable-and-disable-full-solution-analysis-for-managed-code.md).
41+
By default, live code analysis executes for open documents and projects. You can customize this analysis scope to be reduced to current document or increased to entire solution. For more information, see [How to: Configure live code analysis scope for managed code](./configure-live-code-analysis-scope-managed-code.md). In a low memory condition, Visual Studio forces the live analysis scope to be reduced to current document. However, you can re-enable your preferred analysis scope by choosing the **Re-enable** button in the info bar when it appears or by restarting Visual Studio. The Options dialog box always shows the current live code analysis scope settings.
3942

4043
## GC low-latency disabled
4144

@@ -58,6 +61,6 @@ In addition, caches used for internal Visual Studio operations are also cleared.
5861
5962
## See also
6063

61-
- [How to: Enable and Disable Full Solution Analysis](../code-quality/how-to-enable-and-disable-full-solution-analysis-for-managed-code.md)
64+
- [How to: Configure live code analysis scope for managed code](./configure-live-code-analysis-scope-managed-code.md)
6265
- [Fundamentals of Garbage Collection](/dotnet/standard/garbage-collection/fundamentals)
6366
- [Performance considerations for large solutions](https://github.com/dotnet/roslyn/wiki/Performance-considerations-for-large-solutions)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: "Configure live code analysis scope for managed code"
3+
ms.date: 03/23/2018
4+
ms.topic: "conceptual"
5+
helpviewer_keywords:
6+
- "live code analysis"
7+
- "background analysis"
8+
- "analysis scope"
9+
- "full solution analysis"
10+
author: jillre
11+
ms.author: jillfra
12+
manager: jillfra
13+
ms.workload:
14+
- "dotnet"
15+
---
16+
# How to: Configure live code analysis scope for managed code
17+
18+
## What is "Live code analysis" for managed code?
19+
Visual Studio executes a bunch of live code analyses, also referred to as *background analysis*, while you are editing source files in the editor. Some of it is required minimal analysis for an acceptable Visual Studio IDE editing experience. Some of it is for improved responsiveness for IDE features. While some of it is to enable additional IDE functionality, such as diagnostics and code fixes from Roslyn analyzers. Based on the functionality, these analyses can be grouped as follows:
20+
21+
- **Background computation of diagnostics**: Analysis to compute errors, warnings, and suggestions in source files. These diagnostics show up as entries in the error list and as squiggles in the editor. They can be classified into two categories:
22+
- C# and Visual Basic compiler diagnostics
23+
- Roslyn analyzer diagnostics, which includes:
24+
25+
- Built-in IDE analyzers for code style suggestions and
26+
- Third party analyzer packages [installed](./install-roslyn-analyzers.md) for projects in the current solution.
27+
28+
- **Other background analyses**: Analysis to improve the responsiveness and Visual Studio interaction for IDE features. Some examples of such analyses are:
29+
- Background parsing of open files.
30+
- Background compilation of projects with open files to realize symbols for improved responsiveness of certain IDE features.
31+
- Building syntax and symbol caches.
32+
- Detecting designer association for source files, such as forms, controls, etc.
33+
34+
## Default analysis scope
35+
36+
By default, live code analysis for background computation of diagnostics executes for all the files that are _opened_ in Visual Studio. Few of the _other background analyses_ mentioned above execute for all the projects, which have at least one open file. While few background analyses execute for the entire solution.
37+
38+
## Custom analysis scope
39+
40+
The default scope of each background analysis has been tuned for the optimal user experience, functionality, and performance for majority of customer scenarios and solutions. However, there are cases where customers may want to customize this scope to decrease or increase the background analysis. For example:
41+
42+
- Power save mode: If users are running on laptop battery, they may want to minimize the power consumption for longer battery life. In this scenario, they would want to minimize background analysis.
43+
- On-demand code analysis: If users prefer turning off live analyzer execution and manually running code analysis on-demand, they would want to minimize background analysis. See [How to: Manually run code analysis on-demand](./how-to-run-code-analysis-manually-for-managed-code.md).
44+
- Full solution analysis: If users want to always see all diagnostics in all files in the solution, regardless of whether they are open in the editor or not. In this scenario, they would want to maximize background analysis scope to entire solution.
45+
46+
Starting in Visual Studio 2019 version 16.5, users can explicitly customize the scope of all live code analysis, including diagnostics computation, for C# and Visual Basic projects. Available analysis scopes are:
47+
48+
- **Current document**: Minimizes the live code analysis scope to only execute for the current or visible file in the editor.
49+
- **Open documents**: Default live code analysis scope, as described in the above section.
50+
- **Entire solution**: Maximizes the live code analysis scope to execute for all files and projects in the entire solution.
51+
52+
You can choose one of the above custom analysis scopes in Tools Options dialog by following the below steps:
53+
54+
1. To open the **Options** dialog box, on the menu bar in Visual Studio choose **Tools** > **Options**.
55+
56+
2. In the **Options** dialog box, choose **Text Editor** > **C#** or **Basic** > **Advanced**.
57+
58+
3. Select the desired **Background analysis scope** to customize the analysis scope. Choose **OK** when you're done.
59+
60+
![Analysis scope.](./media/background-analysis-scope.png)
61+
62+
> [!NOTE]
63+
> Prior to Visual Studio 2019 version 16.5, users can customize the analysis scope for diagnostics computation to entire solution using the **Enable full solution analysis** check box from **Tools** > **Options** > **Text Editor** > **C#** or **Basic** > **Advanced** tab. There is no support to minimize the background analysis scope in prior Visual Studio versions.
64+
65+
## Automatically minimize live code analysis scope
66+
67+
If Visual Studio detects that 200 MB or less of system memory is available to it, it automatically minimizes the live code analysis scope to "Current Document". If this occurs, an alert appears informing you that Visual Studio has disabled some features. A button lets you switch back to the prior analysis scope if you want.
68+
69+
![Alert text minimizing analysis scope](./media/fsa_alert.png)
70+
71+
## See also
72+
73+
- [Automatic feature suspension](./automatic-feature-suspension.md)
74+
- [Power save mode feature request](https://github.com/dotnet/roslyn/issues/38429)

docs/code-quality/disable-code-analysis.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,13 @@ This page helps you disable code analysis in Visual Studio. There are limitation
1919

2020
.NET Core and .NET Standard projects have options on their Code Analysis properties page that let you turn off code analysis from analyzers installed as a NuGet package. For more information, see [.NET Core and .NET Standard projects](#net-core-and-net-standard-projects). To turn off source code analysis for .NET Framework projects, see [.NET Framework projects](#net-framework-projects).
2121

22-
- NuGet analyzer package versus VSIX or built-in analyzers
23-
24-
Currently, you cannot disable live code analysis for the built-in analyzers, for example, rule ID IDE0067. Similarly, you cannot disable live code analysis for analyzers that were installed as part of a Visual Studio extension (VSIX). To suppress errors and warnings from built-in and VSIX-based analyzers, choose **Analyze** > **Build and Suppress Active Issues** on the menu bar. You *can* disable live and built-time analysis for analyzers installed as part of a NuGet package.
25-
2622
- Source analysis versus legacy analysis
2723

2824
This topic applies to source code analysis and not to legacy (binary) analysis. For information about disabling legacy analysis, see [How to: Enable and disable legacy code analysis](how-to-enable-and-disable-automatic-code-analysis-for-managed-code.md).
2925

3026
## .NET Core and .NET Standard projects
3127

32-
Starting in Visual Studio 2019 version 16.3, there are two checkboxes available in the Code Analysis properties page that let you control whether NuGet-based analyzers run at build time and design time. These options are project specific.
28+
Starting in Visual Studio 2019 version 16.3, there are two checkboxes available in the Code Analysis properties page that let you control whether analyzers run at build time and design time. These options are project-specific.
3329

3430
![Enable or disable live code analysis or on build in Visual Studio](media/run-on-build-run-live-analysis.png)
3531

@@ -39,17 +35,17 @@ To open this page, right-click on the project node in **Solution Explorer** and
3935
- To disable live source analysis, uncheck the **Run on live analysis** option.
4036

4137
> [!NOTE]
42-
> Built-in and VSIX-based analyzers will continue to provide live analysis of your code, even if **Run on live analysis** is unchecked. If you want to suppress errors and warnings from these analyzers, choose **Analyze** > **Build and Suppress Active Issues** on the menu bar.
38+
> Starting in Visual Studio 2019 version 16.5, if you prefer the on-demand code analysis execution workflow, you can disable analyzer execution during live analysis and/or build and manually trigger code analysis once on a project or a solution on demand. For information about running code analysis manually, see [How to: Run Code Analysis Manually for Managed Code](how-to-run-code-analysis-manually-for-managed-code.md).
4339
4440
## .NET Framework projects
4541

46-
To turn off source code analysis for analyzers installed as part of a NuGet package, add one or more of the following MSBuild properties to the [project file](../ide/solutions-and-projects-in-visual-studio.md#project-file).
42+
To turn off source code analysis for analyzers, add one or more of the following MSBuild properties to the [project file](../ide/solutions-and-projects-in-visual-studio.md#project-file).
4743

4844
| MSBuild property | Description | Default |
4945
| - | - | - |
50-
| `RunAnalyzersDuringBuild` | Controls whether NuGet-based analyzers run at build time. | `true` |
51-
| `RunAnalyzersDuringLiveAnalysis` | Controls whether NuGet-based analyzers analyze code live at design time. | `true` |
52-
| `RunAnalyzers` | Disables NuGet-based analyzers at both build and design time. This property takes precedence over `RunAnalyzersDuringBuild` and `RunAnalyzersDuringLiveAnalysis`. | `true` |
46+
| `RunAnalyzersDuringBuild` | Controls whether analyzers run at build time. | `true` |
47+
| `RunAnalyzersDuringLiveAnalysis` | Controls whether analyzers analyze code live at design time. | `true` |
48+
| `RunAnalyzers` | Disables analyzers at both build and design time. This property takes precedence over `RunAnalyzersDuringBuild` and `RunAnalyzersDuringLiveAnalysis`. | `true` |
5349

5450
Examples:
5551

@@ -67,7 +63,7 @@ Examples:
6763

6864
You cannot turn off [source analysis](roslyn-analyzers-overview.md) in Visual Studio 2017. If you want to clear analyzer errors from the Error List, you can suppress all the current violations by choosing **Analyze** > **Run Code Analysis and Suppress Active Issues** on the menu bar. For more information, see [Suppress violations](use-roslyn-analyzers.md#suppress-violations).
6965

70-
Starting in Visual Studio 2019 version 16.3, you can turn off NuGet-based source code analysis. Consider upgrading to Visual Studio 2019.
66+
Starting in Visual Studio 2019 version 16.3, you can turn off source code analysis or execute it on demand. Consider upgrading to Visual Studio 2019.
7167

7268
## Legacy analysis
7369

docs/code-quality/fxcop-analyzers-faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ FxCop analyzers are based on the .NET Compiler Platform ("Roslyn"). You [install
2525
2626
## Does the Run Code Analysis command run FxCop analyzers?
2727

28-
No. When you select **Analyze** > **Run Code Analysis**, it executes legacy analysis. **Run Code Analysis** has no effect on Roslyn-based analyzers, including the Roslyn-based FxCop analyzers.
28+
Prior to Visual Studio 2019 16.5 release, when you select **Analyze** > **Run Code Analysis**, it executes legacy analysis. Starting Visual Studio 2019 16.5, **Run Code Analysis** menu option executes Roslyn-based analyzers for the selected project or solution. If you have installed Roslyn-based FxCop analyzers, they would also be executed. For more information, see [How to: Run Code Analysis Manually for Managed Code](how-to-run-code-analysis-manually-for-managed-code.md).
2929

3030
## Does the RunCodeAnalysis msbuild project property run analyzers?
3131

32-
No. The **RunCodeAnalysis** property in a project file (for example, *.csproj*) is only used to execute legacy FxCop. It runs a post-build msbuild task that invokes **FxCopCmd.exe**. This is equivalent to selecting **Analyze** > **Run Code Analysis** in Visual Studio.
32+
No. The **RunCodeAnalysis** property in a project file (for example, *.csproj*) is only used to execute legacy FxCop. It runs a post-build msbuild task that invokes **FxCopCmd.exe**.
3333

3434
## So how do I run FxCop analyzers then?
3535

docs/code-quality/how-to-configure-code-analysis-for-a-managed-code-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ In Visual Studio, you can choose from a list of code analysis [rule sets](../cod
3939

4040
::: moniker range=">=vs-2019"
4141

42-
3. To run code analysis every time the project is built using the selected configuration, select **Run on build** in the **Binary analyzers** section. You can also run code analysis manually by selecting **Analyze** > **Run Code Analysis** > **Run Code Analysis on \<projectname>**.
42+
3. To run code analysis every time the project is built using the selected configuration, select **Run on build** in the **Binary analyzers** section. You can also run legacy code analysis manually, see [How to: Run Legacy Code Analysis Manually for Managed Code](how-to-run-legacy-code-analysis-manually-for-managed-code.md) for more details.
4343

4444
::: moniker-end
4545

docs/code-quality/how-to-enable-and-disable-full-solution-analysis-for-managed-code.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)