Skip to content

Commit d7d434e

Browse files
Merge pull request #10529 from MicrosoftDocs/main638694760334721159sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents f36542c + 162c15d commit d7d434e

19 files changed

+143
-50
lines changed

.openpublishing.publish.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"moniker_ranges": [],
1111
"open_to_public_contributors": true,
1212
"type_mapping": {
13-
"Conceptual": "Content"
13+
"Conceptual": "Content",
14+
"ZonePivotGroups": "Toc"
1415
},
1516
"build_entry_point": "docs",
1617
"template_folder": "_themes"

docs/code-quality/code-metrics-cyclomatic-complexity.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Code metrics - Cyclomatic complexity
3-
ms.date: 5/7/2021
3+
ms.date: 12/10/2024
44
description: Explore the cyclomatic complexity metric for code metrics in Visual Studio and estimate the difficulty to test, maintain, and troubleshoot your code.
55
ms.topic: conceptual
66
author: mikejo5000
@@ -25,33 +25,33 @@ Notice the cyclomatic complexity is at 2 (the lowest value possible). If you add
2525

2626
![Cyclomatic complexity example 2](media/cyclomatic-complexity-example-2.png)
2727

28-
If you add a decision, the cyclomatic complexity value goes up by 1:
28+
If you add a decision, the cyclomatic complexity value goes up by one:
2929

3030
![Cyclomatic complexity example 3](media/cyclomatic-complexity-example-3.png)
3131

32-
When you change the if statement to a switch statement with 4 decisions to be made then, it goes from the original 2 to 6:
32+
When you change the if statement to a switch statement with four decisions to be made then, it goes from the original two to six:
3333

3434
![Cyclomatic complexity example 4](media/cyclomatic-complexity-example-4.png)
3535

3636
Let's take a look at a (hypothetical) larger code base.
3737

3838
![Cyclomatic complexity example 5](media/cyclomatic-complexity-example-5.png)
3939

40-
Notice that most of the items, as you drill down into the Products_Related class, have a value of 1 but a couple of them have a complexity of 5. By itself, this might not be a big deal, but given that most other members have a 1 in the same class, you should definitely look closer at those two items and see what is in them. You can do this by right-clicking the item and choosing **Go To Source Code** from the context menu. Take a closer look at `Product.set(Product)`:
40+
Notice that most of the items, as you drill down into the Products_Related class, have a value of one but a couple of them have a complexity of five. By itself, this difference might not be a big deal, but given that most other members have a one in the same class, you should definitely look closer at those two items and see what is in them. You can do take a closer look by right-clicking the item and choosing **Go To Source Code** from the context menu. Take a closer look at `Product.set(Product)`:
4141

4242
![Cyclomatic complexity example 6](media/cyclomatic-complexity-example-6.png)
4343

44-
Given all the if statements, you can see why the cyclomatic complexity is at a 5. At this point, you might decide that this is an acceptable level of complexity, or you might refactor to reduce the complexity.
44+
Given all the if statements, you can see why the cyclomatic complexity is at a five. At this point, you might decide that this result is an acceptable level of complexity, or you might refactor to reduce the complexity.
4545

4646
## The Magic Number
4747

48-
As with many metrics in this industry, there is no exact cyclomatic complexity limit that fits all organizations. However, [NIST235](#nist235) does indicate that a limit of 10 is a good starting point:
48+
As with many metrics in this industry, there's no exact cyclomatic complexity limit that fits all organizations. However, [NIST235](#nist235) does indicate that a limit of 10 is a good starting point:
4949

50-
"The precise number to use as a limit, however, remains somewhat controversial. The original limit of 10 as proposed by McCabe has significant supporting evidence, but limits as high as 15 have been used successfully as well. Limits over 10 should be reserved for projects that have several operational advantages over typical projects, for example experienced staff, formal design, a modern programming language, structured programming, code walkthroughs, and a comprehensive test plan. In other words, an organization can pick a complexity limit greater than 10, but only if it is sure it knows what it is doing and is willing to devote the additional testing effort required by more complex modules." [NIST235](#nist235)
50+
"The precise number to use as a limit, however, remains somewhat controversial. The original limit of 10 as proposed by McCabe has significant supporting evidence, but limits as high as 15 have been used successfully as well. Limits over 10 should be reserved for projects that have several operational advantages over typical projects, for example experienced staff, formal design, a modern programming language, structured programming, code walkthroughs, and a comprehensive test plan. In other words, an organization can pick a complexity limit greater than 10, but only if it's sure it knows what it's doing and is willing to devote the additional testing effort required by more complex modules." [NIST235](#nist235)
5151

5252
## Cyclomatic Complexity and Line Numbers
5353

54-
Just looking at the number of lines of code by itself is, at best, a very broad predictor of code quality. There is some basic truth to the idea that the more lines of code in a function, the more likely it is to have errors. However, when you combine cyclomatic complexity with lines of code, then you have a much clearer picture of the potential for errors.
54+
Just looking at the number of lines of code by itself is, at best, a very broad predictor of code quality. There's some basic truth to the idea that the more lines of code in a function, the more likely it's to have errors. However, when you combine cyclomatic complexity with lines of code, then you have a much clearer picture of the potential for errors.
5555

5656
As described by the Software Assurance Technology Center (SATC) at NASA:
5757

docs/code-quality/index.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
ms.topic: landing-page
1111
author: Mikejo5000
1212
ms.author: mikejo
13-
ms.date: 10/15/2019
13+
ms.date: 12/10/2024
1414

1515
# linkListType: architecture | concept | deploy | download | get-started | how-to-guide | learn | overview | quickstart | reference | tutorial | video | whats-new
1616

@@ -53,9 +53,9 @@ landingContent:
5353
url: /dotnet/fundamentals/productivity/code-analysis#code-style-analysis
5454
- linkListType: reference
5555
links:
56-
- text: .NET code quality rules
56+
- text: .NET code quality rules >>
5757
url: /dotnet/fundamentals/code-analysis/quality-rules/
58-
- text: .NET code style rules
58+
- text: .NET code style rules >>
5959
url: /dotnet/fundamentals/code-analysis/style-rules/
6060

6161
# Card

docs/containers/deploy-app-service.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ ms.author: ghogen
1414

1515
This tutorial walks you through using Visual Studio to publish your containerized ASP.NET Core web application to an [Azure App Service](/azure/app-service). Azure App Service is an appropriate service for a single-container web app hosted in Azure.
1616

17+
You can also deploy to [Azure Container Apps](/azure/container-apps/overview). For a tutorial, see [Deploy to Azure Container Apps using Visual Studio](/azure/container-apps/deploy-visual-studio).
18+
1719
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/dotnet/?utm_source=acr-publish-doc&utm_medium=docs&utm_campaign=docs) before you begin.
1820

1921
## Prerequisites

docs/containers/index.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ landingContent:
5454
url: hosting-web-apps-in-docker.md
5555
- text: Deploy to Azure App Service
5656
url: deploy-app-service.md
57+
- text: Deploy to Azure Container apps
58+
url: /azure/container-apps/deploy-visual-studio
5759
- text: Deploy to Docker Hub
5860
url: deploy-docker-hub.md
5961
- text: Deploy without a Dockerfile

docs/containers/launch-profiles.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ manager: mijacobs
66
ms.subservice: container-tools
77
ms.devlang: dotnet
88
ms.topic: how-to
9-
ms.date: 10/08/2021
9+
ms.date: 12/10/2024
1010
ms.author: ghogen
1111
monikerRange: ">=vs-2019"
1212
---
1313

1414
# Launch a subset of Compose services
1515

16-
If you have an application that consists of multiple services and uses Docker Compose, you can configure which services run and debug by creating or editing an existing launch profile in Docker Compose launch settings. Launch profiles allow you to dynamically run only the services that matter to your current scenario. You can create and select from launch profiles in order to customize your debugging experience and set specific launch actions such as `Browser Launch URL`. You will also have the option of either choosing each service individually or by choosing a Docker Compose profile, which also looks at your Compose file to determine the group of services to run.
16+
If you have an application that consists of multiple services and uses Docker Compose, you can configure which services run and debug by creating or editing an existing launch profile in Docker Compose launch settings. Launch profiles allow you to dynamically run only the services that matter to your current scenario. You can create and select from launch profiles in order to customize your debugging experience and set specific launch actions such as `Browser Launch URL`. You also have the option of either choosing each service individually or by choosing a Docker Compose profile, which also looks at your Compose file to determine the group of services to run.
1717

1818
For information about Docker Compose profiles, see [Using profiles with Compose](https://docs.docker.com/compose/profiles/).
1919

@@ -97,7 +97,7 @@ The next example demonstrates selecting between individual services instead of f
9797

9898
![Screenshot of launch settings dialog with some services deselected](media/launch-settings/launch-settings-selected.png)
9999

100-
And this information will be saved in *launchSettings.json* as shown below
100+
And this information is saved in *launchSettings.json* as shown below
101101

102102
```json
103103
{
@@ -124,14 +124,14 @@ And this information will be saved in *launchSettings.json* as shown below
124124

125125
You can also further customize launch behaviors by creating Visual Studio launch profiles that make use of the Compose profiles.
126126

127-
To create another profile that makes use of the Compose profile, select **Use Docker Compose profiles** and choose `web1`. Now the launch profile includes three services`webapplication1` (which belongs to both `web` and `web1` Compose profiles), `external1` and `external2`. By default, the services without source code such as `external1` and `external2` have the default action of **Start without debugging**. .NET applications with source code will default to **Start debugging**.
127+
To create another profile that makes use of the Compose profile, select **Use Docker Compose profiles** and choose `web1`. Now the launch profile includes three services: `webapplication1` (which belongs to both `web` and `web1` Compose profiles), `external1`, and `external2`. By default, the services without source code such as `external1` and `external2` have the default action of **Start without debugging**. .NET applications with source code defaults to **Start debugging**.
128128

129129
> [!IMPORTANT]
130-
> If a service doesn't specify a Compose profile, it will be included in all Compose profiles implicitly.
130+
> If a service doesn't specify a Compose profile, it's included in all Compose profiles implicitly.
131131
132132
![Screenshot of launch settings dialog with another profile created](media/launch-settings/launch-settings-create-profile.png)
133133

134-
This information will be saved as shown in the following code. The configuration for the service and its default action are not saved unless you change the default action.
134+
This information is saved as shown in the following code. The configuration for the service and its default action are not saved unless you change the default action.
135135

136136
```json
137137
{
@@ -172,7 +172,7 @@ You can also change the action of webapplication1 to **Start without debugging**
172172

173173
## Properties
174174

175-
Here is a description of each property in the *launchSettings.json*:
175+
Here's a description of each property in the *launchSettings.json*:
176176

177177
|Property| Description|
178178
| - | - |

docs/containers/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,7 @@ For further details on the services implementation and use of Visual Studio tool
291291
[Debugging apps in a local Docker container](edit-and-refresh.md)
292292

293293
[Deploy an ASP.NET container to a container registry using Visual Studio](hosting-web-apps-in-docker.md)
294+
295+
[Deploy to Azure App Service](deploy-app-service.md)
296+
297+
[Deploy to Azure Container Apps using Visual Studio](/azure/container-apps/deploy-visual-studio)

docs/debugger/using-breakpoints.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ author: mikejo5000
2121
ms.author: mikejo
2222
manager: mijacobs
2323
ms.subservice: debug-diagnostics
24+
zone_pivot_groups: programming-languages-set-one
2425
---
2526
# Use the right type of breakpoint
2627

2728
This article shows how to use different types of breakpoints in Visual Studio to improve debugging efficiency. It covers various scenarios where breakpoints can be applied, such as pausing code execution, logging information, and tracking changes in variable states. The article explains how to set conditional breakpoints, tracepoints, data breakpoints, dependent breakpoints, and temporary breakpoints. It also includes detailed instructions on setting function breakpoints. This guide is essential for developers looking to leverage breakpoints for effective debugging in Visual Studio.
2829

2930
If you're unfamiliar with using breakpoints in Visual Studio, see [Get started with breakpoints](get-started-with-breakpoints.md) before going through this article.
30-
31+
32+
::: zone pivot="programming-language-dotnet,programming-language-dotnetf,programming-language-cpp,programming-language-all"
3133
## Scenarios
3234

3335
The following table shows common debugging scenarios for breakpoints and the recommended breakpoint type for the scenario.
@@ -43,6 +45,7 @@ The following table shows common debugging scenarios for breakpoints and the rec
4345
| Can I pause code inside a loop at a certain iteration? | Set a Dependent breakpoint that breaks execution only if another breakpoint is first hit. For more information, see [Hit count](#set-a-hit-count-condition). |
4446
| Can I pause code at the start of a function when I know the function name but not its location? | You can do this with a function breakpoint. For more information, see [Set function breakpoints](#BKMK_Set_a_breakpoint_in_a_source_file). |
4547
| Can I pause code at the start of multiple functions with the same name? | When you have multiple functions with the same name (overloaded functions or functions in different projects), you can use a [function breakpoint](#BKMK_Set_a_breakpoint_in_a_source_file). |
48+
::: zone-end
4649

4750
## <a name="BKMK_Print_to_the_Output_window_with_tracepoints"></a> Breakpoint actions and tracepoints
4851

@@ -103,6 +106,7 @@ If you set a breakpoint condition with invalid syntax, a warning message appears
103106
>[!NOTE]
104107
> For the **When changed** field, the debugger doesn't consider the first evaluation of the condition to be a change, so doesn't hit the breakpoint on the first evaluation.
105108
109+
::: zone pivot="programming-language-dotnet,programming-language-dotnetf"
106110
### <a name="using-object-ids-in-breakpoint-conditions-c-and-f"></a> Use Object IDs in conditional expressions (C# and F# only)
107111

108112
There are times when you want to observe the behavior of a specific object. For example, you might want to find out why an object was inserted into a collection more than once. In C# and F#, you can create object IDs for specific instances of [reference types](/dotnet/csharp/language-reference/keywords/reference-types), and use them in breakpoint conditions. The object ID is generated by the common language runtime (CLR) debugging services and associated with the object.
@@ -127,6 +131,7 @@ If you set a breakpoint condition with invalid syntax, a warning message appears
127131

128132
> [!NOTE]
129133
> Object IDs create weak references, and do not prevent the object from being garbage collected. They are valid only for the current debugging session.
134+
::: zone-end
130135

131136
### Set a hit count condition
132137

@@ -191,6 +196,7 @@ You can break execution when a function is called. This is useful, for example,
191196

192197
1. Select **OK**.
193198

199+
::: zone pivot="programming-language-cpp"
194200
### Set a function breakpoint using a memory address (native C++ only)
195201

196202
You can use the address of an object to set a function breakpoint on a method called by a specific instance of a class. For example, given an addressable object of type `my_class`, you can set a function breakpoint on the `my_method` method that instance calls.
@@ -206,9 +212,10 @@ You can break execution when a function is called. This is useful, for example,
206212
```cpp
207213
((my_class *) 0xcccccccc)->my_method
208214
```
209-
215+
::: zone-end
210216
::: moniker range=">= vs-2019"
211217

218+
::: zone pivot="programming-language-dotnet"
212219
## <a name="BKMK_set_a_data_breakpoint_managed"></a>Set data breakpoints (.NET Core 3.x or .NET 5+)
213220

214221
Data breakpoints break execution when a specific object's property changes.
@@ -229,9 +236,10 @@ Data breakpoints for .NET Core and .NET 5+ won't work for:
229236
- Fields inside of structs
230237

231238
For the maximum number that you can set, see [Data breakpoint hardware limits](#data-breakpoint-hardware-limits).
232-
239+
::: zone-end
233240
::: moniker-end
234241

242+
::: zone pivot="programming-language-cpp"
235243
## <a name="BKMK_set_a_data_breakpoint_native_cplusplus"></a>Set data breakpoints (native C++ only)
236244

237245
Data breakpoints break execution when a value stored at a specified memory address changes. If the value is read but not changed, execution doesn't break.
@@ -256,7 +264,9 @@ Data breakpoints don't work under the following conditions:
256264
> - Data breakpoints depend on specific memory addresses. The address of a variable changes from one debugging session to the next, so data breakpoints are automatically disabled at the end of each debugging session.
257265
>
258266
> - If you set a data breakpoint on a local variable, the breakpoint remains enabled when the function ends, but the memory address is no longer applicable, so the behavior of the breakpoint is unpredictable. If you set a data breakpoint on a local variable, you should delete or disable the breakpoint before the function ends.
267+
::: zone-end
259268

269+
::: zone pivot="programming-language-dotnet,programming-language-cpp"
260270
## Data breakpoint hardware limits
261271

262272
The Windows kernel and the underlying hardware have the following limits when setting data breakpoints. The limit refers to the maximum number of data breakpoints that you can set.
@@ -266,7 +276,7 @@ The Windows kernel and the underlying hardware have the following limits when se
266276
|x64 and x86|4|
267277
|ARM64|2|
268278
|ARM|1|
269-
279+
::: zone-end
270280
::: moniker range=">= vs-2022"
271281
## <a name="BKMK_set_a_dependent_breakpoint"></a>Set a dependent breakpoint
272282

docs/deployment/deploying-applications-services-and-components-resources.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ For more information on publishing to App Service, see:
114114
- [Publish an ASP.NET Core app to Azure App Service](/aspnet/core/tutorials/publish-to-azure-webapp-using-vs)
115115
- [Troubleshoot ASP.NET Core on Azure App Service and IIS](/aspnet/core/test/troubleshoot-azure-iis).
116116

117+
### Azure WebJobs
118+
119+
Azure WebJobs is supported through App Service. See [Develop and deploy WebJobs using Visual Studio](/azure/app-service/webjobs-dotnet-deploy-vs).
120+
121+
#### When to choose Azure WebJobs
122+
123+
- You have a worker process, a computation that can run without user interaction.
124+
- The job is on-demand, triggered by an event, or continuous.
125+
- The job runs on Windows, or .NET Core on Linux (with Visual Studio 17.12 or later).
126+
127+
Another option for similar scenarios is Azure Functions. To choose the right option for you, see [Choose the right integration and automation services in Azure](/azure/azure-functions/functions-compare-logic-apps-ms-flow-webjobs).
128+
117129
### Azure Container Registry
118130

119131
[Azure Container Registry](/azure/container-registry/) allows you to build, store, and manage Docker container images and artifacts in a private registry for all types of container deployments.

docs/docfx.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
"feedback_help_link_type": "ask-the-community",
9999
"feedback_product_url": "https://developercommunity.visualstudio.com/VisualStudio/suggest",
100100
"breadcrumb_path": "/visualstudio/_breadcrumb/toc.json",
101+
"zone_pivot_group_filename": "zone-pivot-groups.json",
101102
"manager": "jmartens",
102103
"audience": "developer",
103104
"defaultDevLang": "csharp",

0 commit comments

Comments
 (0)