Skip to content

Commit c723986

Browse files
Merge pull request #10173 from MicrosoftDocs/main638478688290550180sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 7778264 + c89e0fe commit c723986

10 files changed

+61
-101
lines changed

.openpublishing.redirection.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{
22
"redirections": [
33
{
4-
"source_path": "doc/azure/vs-azure-tools-optimizing-azure-code-in-visual-studio.md",
4+
"source_path": "docs/msbuild/logging-in-a-multi-processor-environment.md",
5+
"redirect_url": "/visualstudio/msbuild/writing-multi-processor-aware-loggers",
6+
"redirect_document_id": "false"
7+
},
8+
{
9+
"source_path": "docs/azure/vs-azure-tools-optimizing-azure-code-in-visual-studio.md",
510
"redirect_url": "/visualstudio/azure/overview",
611
"redirect_document_id": "false"
712
},

docs/debugger/debug-with-copilot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ In addition, Copilot provides more precise help for a few targeted scenarios inc
2727
- Exceptions
2828
- Auto Insights for CPU Usage
2929

30-
To get AI assistance While you're debugging in these scenarios, look for the **Ask Copilot** ![Screenshot of Ask Copilot button.](../debugger/media/vs-2022/debug-with-copilot-ask-copilot-button.png) button. In these scenarios, Copilot already knows the context for your questions. For example, it knows the current call stack, the code line you are asking about, and the name of the exception (if one occurred), so you don't need to provide context yourself in chat.
30+
To get AI assistance while you're debugging in these scenarios, look for the **Ask Copilot** ![Screenshot of Ask Copilot button.](../debugger/media/vs-2022/debug-with-copilot-ask-copilot-button.png) button. In these scenarios, Copilot already knows the context for your questions. For example, it knows the current call stack, the code line you are asking about, and the name of the exception (if one occurred), so you don't need to provide context yourself in chat.
3131

3232
For more information on the GitHub Copilot extension in Visual Studio, see [About the GitHub Copilot extension for Visual Studio](../ide/visual-studio-github-copilot-extension.md).
3333

docs/debugger/debugger-feature-tour.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ The Exception Helper is a great feature that can help you debug errors. You can
237237

238238
Expand the **Exception Settings** node to see more options on how to handle this exception type, but you don't need to change anything for this tour!
239239

240+
::: moniker range=">= vs-2022"
241+
> [!TIP]
242+
> If you have [Copilot](../ide/visual-studio-github-copilot-extension.md), you can get AI assistance while you're debugging exceptions. Just look for the **Ask Copilot** ![Screenshot of Ask Copilot button.](../debugger/media/vs-2022/debug-with-copilot-ask-copilot-button.png) button. For more information, see [Debug with Copilot](../debugger/debug-with-copilot.md).
243+
::: moniker-end
244+
240245
## Configure debugging
241246

242247
You can configure your project to build as a [Debug or Release configuration](../debugger/how-to-set-debug-and-release-configurations.md), configure project properties for debugging, or configure [general settings](../debugger/how-to-specify-debugger-settings.md) for debugging. In addition, you can configure the debugger to display custom information using features such as [DebuggerDisplay](using-the-debuggerdisplay-attribute.md) attribute or, for C/C++, the [NatVis framework](create-custom-views-of-native-objects.md).

docs/debugger/exception-helper.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ Starting in Visual Studio 2022 version 17.3, you can view exception stack frames
6666

6767
![Exception helper with call stack](media/vs-2022/debugger-exception-helper-call-stack.png)
6868
::: moniker-end
69+
::: moniker range=">= vs-2022"
70+
## Get AI asistance
71+
72+
If you have [Copilot](../ide/visual-studio-github-copilot-extension.md), you can get AI assistance while you're debugging exceptions. Just look for the **Ask Copilot** ![Screenshot of Ask Copilot button.](../debugger/media/vs-2022/debug-with-copilot-ask-copilot-button.png) button. In these scenarios, Copilot already knows the context for your questions, so you don't need to provide context yourself in chat. For more information, see [Debug with Copilot](../debugger/debug-with-copilot.md).
73+
::: moniker-end
6974

7075
## Share a debug session with Live Share
7176

docs/debugger/write-better-code-with-visual-studio.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ Here are a couple of important tips for exception handling:
301301

302302
For the sample app, fix the `SerializationException` in the `GetJsonData` method by changing `4o` to `40`.
303303

304+
::: moniker range=">= vs-2022"
305+
> [!TIP]
306+
> If you have [Copilot](../ide/visual-studio-github-copilot-extension.md), you can get AI assistance while you're debugging exceptions. Just look for the **Ask Copilot** ![Screenshot of Ask Copilot button.](../debugger/media/vs-2022/debug-with-copilot-ask-copilot-button.png) button. For more information, see [Debug with Copilot](../debugger/debug-with-copilot.md).
307+
::: moniker-end
308+
304309
## Clarify your code intent by using assert
305310

306311
Select the **Restart** ![Restart App](../debugger/media/dbg-tour-restart.png "RestartApp") button in the Debug Toolbar (**Ctrl** + **Shift** + **F5**). This restarts the app in fewer steps. You see the following output in the console window.

docs/msbuild/logging-in-a-multi-processor-environment.md

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

docs/msbuild/toc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,6 @@ items:
190190
href: obtaining-build-logs-with-msbuild.md
191191
- name: Build loggers
192192
href: build-loggers.md
193-
- name: Logging in a multi-processor environment
194-
href: logging-in-a-multi-processor-environment.md
195193
- name: Writing multi-processor-aware loggers
196194
href: writing-multi-processor-aware-loggers.md
197195
- name: Creating forwarding loggers

docs/msbuild/writing-multi-processor-aware-loggers.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Writing Multi-Processor-Aware Loggers"
33
description: Learn how MSBuild provides a multi-processor-aware logger and logging model, and lets you create custom "forwarding loggers."
4-
ms.date: "11/04/2016"
4+
ms.date: 04/03/2024
55
ms.topic: "conceptual"
66
helpviewer_keywords:
77
- "msbuild, multi-proc aware loggers"
@@ -14,11 +14,15 @@ ms.subservice: msbuild
1414
---
1515
# Write multi-processor-aware loggers
1616

17-
The ability of MSBuild to take advantage of multiple processors can decrease project building time, but it also adds complexity to build event logging. In a single-processor environment, events, messages, warnings, and errors arrive at the logger in a predictable, sequential manner. However, in a multi-processor environment, events from different sources can arrive at the same time or out of sequence. To provide for this, MSBuild provides a multi-processor-aware logger and a new logging model, and lets you create custom "forwarding loggers."
17+
The ability of MSBuild to take advantage of multiple processors can decrease project building time, but it also adds complexity to build event logging. In a single-processor environment, events, messages, warnings, and errors arrive at the logger in a predictable, sequential manner. However, in a multi-processor environment, events from different sources can arrive at the same time or out of sequence.
18+
19+
Generating a binary log (`-binlog` or `-bl` switch) and viewing it with the [structured log viewer](https://msbuildlog.com/) largely solves this issue. With MSBuild version 17.8 or later, you can also try the terminal logger (`-tl` switch) for more user-friendly logging output in real time at the console.
20+
21+
For a more general solution, MSBuild provides a multi-processor-aware logger and a logging model that you can use to create custom "forwarding loggers."
1822

1923
## Multi-processor logging challenges
2024

21-
When you build one or more projects on a multi-processor or multi-core system, MSBuild build events for all the projects are generated at the same time. An avalanche of event messages may arrive at the logger at the same time or out of sequence. Because an MSBuild 2.0 logger is not designed to handle this situation, it can overwhelm the logger and cause increased build times, incorrect logger output, or even a broken build. To address these issues, the logger (starting in MSBuild 3.5) can process out-of-sequence events and correlate events and their sources.
25+
When you build one or more projects on a multi-processor or multi-core system, MSBuild build events for all the projects are generated at the same time. An avalanche of event messages may arrive at the logger at the same time or out of sequence. Because an MSBuild 2.0 logger is not designed to handle this situation, it can overwhelm the logger and cause increased build times, incorrect logger output, or even a broken build. To address these issues, the logger can process out-of-sequence events and correlate events and their sources.
2226

2327
You can improve logging efficiency even more by creating a custom forwarding logger. A custom forwarding logger acts as a filter by letting you choose, before you build, only the events you want to monitor. When you use a custom forwarding logger, unwanted events cannot overwhelm the logger, clutter your logs, or slow build times.
2428

@@ -65,13 +69,25 @@ public interface INodeLogger: ILogger
6569

6670
- Write your own custom forwarding logger.
6771

68-
You can modify ConfigurableForwardingLogger to suit your requirements. To do this, call the logger on the command line by using *MSBuild.exe*, and list the build events that you want the logger to forward to the central node.
72+
You can modify `ConfigurableForwardingLogger` to suit your requirements. To do this, call the logger on the command line by using *MSBuild.exe*, and list the build events that you want the logger to forward to the central node.
73+
74+
As an alternative, you can create a custom forwarding logger. By creating a custom forwarding logger, you can fine-tune the behavior of the logger. However, creating a custom forwarding logger is more complex than just customizing the ConfigurableForwardingLogger. You can create a forwarding logger by implementing the <xref:Microsoft.Build.Framework.IForwardingLogger> interface, which derives from <xref:Microsoft.Build.Framework.ILogger>. The interface is defined as:
75+
76+
```csharp
77+
public interface IForwardingLogger: INodeLogger
78+
{
79+
public IEventRedirector EventRedirector { get; set; }
80+
public int NodeId { get; set; }
81+
}
82+
```
83+
84+
To forward an event that your logger cares about, call the <xref:Microsoft.Build.Framework.IEventRedirector.ForwardEvent%2A> method of the <xref:Microsoft.Build.Framework.IEventRedirector> interface in your forwarding logger. Pass the appropriate <xref:Microsoft.Build.Framework.BuildEventArgs>, or a derivative, as the parameter. The events will then be forwarded to the central logger and can be acted on there.
6985

70-
As an alternative, you can create a custom forwarding logger. By creating a custom forwarding logger, you can fine-tune the behavior of the logger. However, creating a custom forwarding logger is more complex than just customizing the ConfigurableForwardingLogger. For more information, see [Creating forwarding loggers](../msbuild/creating-forwarding-loggers.md).
86+
For more information, see [Creating forwarding loggers](../msbuild/creating-forwarding-loggers.md).
7187

7288
## Using the ConfigurableForwardingLogger for simple distributed logging
7389

74-
To attach either a ConfigurableForwardingLogger or a custom forwarding logger, use the `-distributedlogger` switch (`-dl` for short) in an *MSBuild.exe* command-line build. The format for specifying the names of the logger types and classes is the same as that for the `-logger` switch, except that a distributed logger always has two logging classes instead of one, the forwarding logger and the central logger. The following is an example of how to attach a custom forwarding logger named XMLForwardingLogger.
90+
To attach either a `ConfigurableForwardingLogger` or a custom forwarding logger, use the `-distributedlogger` switch (`-dl` for short) in an *MSBuild.exe* command-line build. The format for specifying the names of the logger types and classes is the same as that for the `-logger` switch, except that a distributed logger always has two logging classes instead of one, the forwarding logger and the central logger. The following is an example of how to attach a custom forwarding logger named XMLForwardingLogger.
7591

7692
```cmd
7793
msbuild.exe myproj.proj -distributedlogger:XMLCentralLogger,MyLogger,Version=1.0.2,Culture=neutral*XMLForwardingLogger,MyLogger,Version=1.0.2,Culture=neutral
@@ -80,7 +96,7 @@ msbuild.exe myproj.proj -distributedlogger:XMLCentralLogger,MyLogger,Version=1.0
8096
> [!NOTE]
8197
> An asterisk (*) must separate the two logger names in the `-dl` switch.
8298
83-
Using the ConfigurableForwardingLogger is like using any other logger (as outlined in [Obtaining build logs](../msbuild/obtaining-build-logs-with-msbuild.md)), except that you attach the ConfigurableForwardingLogger logger instead of the typical MSBuild logger and you specify as parameters the events that you want the ConfigurableForwardingLogger to pass on to the central node.
99+
Using the `ConfigurableForwardingLogger` is like using any other logger (as outlined in [Obtaining build logs](../msbuild/obtaining-build-logs-with-msbuild.md)), except that you attach the ConfigurableForwardingLogger logger instead of the typical MSBuild logger and you specify as parameters the events that you want the ConfigurableForwardingLogger to pass on to the central node.
84100

85101
For example, if you want to be notified only when a build starts and ends, and when an error occurs, you would pass `BUILDSTARTEDEVENT`, `BUILDFINISHEDEVENT`, and `ERROREVENT` as parameters. Multiple parameters can be passed by separating them with semi-colons. The following is an example of how to use the ConfigurableForwardingLogger to forward only the `BUILDSTARTEDEVENT`, `BUILDFINISHEDEVENT`, and `ERROREVENT` events.
86102

docs/profiling/cpu-insights.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ monikerRange: '>= vs-2022'
1111
---
1212
# Diagnose high latency with CPU Insights
1313

14-
**CPU Insights** is a sub-feature of the CPU Usage tool that shows common potential latency issues like concatenating strings inefficiently.
14+
CPU insights is a sub-feature of the CPU Usage tool that shows common potential latency issues like concatenating strings inefficiently.
1515

1616
## View top insights
1717

@@ -29,6 +29,12 @@ On the summary page under **Top Functions**, you can find the top functions call
2929

3030
![Screenshot showing Hot Path selected.](./media/vs-2022/hot-path.png "Hot Path selected")
3131

32+
::: moniker range=">= vs-2022"
33+
## Get AI asistance
34+
35+
If you have [Copilot](../ide/visual-studio-github-copilot-extension.md), you can get AI assistance while you're looking at CPU insights. Just look for the **Ask Copilot** ![Screenshot of Ask Copilot button.](../debugger/media/vs-2022/debug-with-copilot-ask-copilot-button.png) button. In these scenarios, Copilot already knows the context for your questions, so you don't need to provide context yourself in chat. For more information, see [Debug with Copilot](../debugger/debug-with-copilot.md).
36+
::: moniker-end
37+
3238
## Related content
3339

3440
- [Analyze CPU usage in the Performance Profiler](../profiling/cpu-usage.md)

0 commit comments

Comments
 (0)