Skip to content

Commit 469e968

Browse files
Merge pull request #10032 from MicrosoftDocs/main638430988083050184sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 5f19675 + 4545acf commit 469e968

27 files changed

+246
-308
lines changed

docs/extensibility/visualstudio.extensibility/editor/editor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ To avoid misplaced edits, edits from editor extensions are applied as follows:
227227
228228
### Asynchronous execution
229229
230-
[ITextViewSnapshot.GetTextDocumentAsync](/dotnet/api/microsoft.visualstudio.extensibility.editor.itextviewsnapshot.gettextdocumentasync#microsoft-visualstudio-extensibility-editor-itextviewsnapshot-gettextdocumentasync(system-threading-cancellationtoken)) opens a copy of the text document in the Visual Studio extension. Since extensions run in a separate process, all extension interactions are asynchronous, cooperative, and have some caveats:
230+
[ITextViewSnapshot.GetTextDocumentAsync](/visualstudio/extensibility/visualstudio.extensibility/editor/editor-concepts?view=vs-2022#itextviewsnapshot) opens a copy of the text document in the Visual Studio extension. Since extensions run in a separate process, all extension interactions are asynchronous, cooperative, and have some caveats:
231231
232232
> [!CAUTION]
233233
> `GetTextDocumentAsync` might fail if called on an old `ITextDocument`, because it may no longer be cached by the Visual Studio client, if the user has made many changes since it was created. For this reason, if you plan to store an `ITextView` to access its document later, and can't tolerate failure, it may be a good idea to call `GetTextDocumentAsync` immediately. Doing so fetches the text content for that version of the document into your extension, ensuring that a copy of that version is sent to your extension before it expires.

docs/extensibility/visualstudio.extensibility/visualstudio-extensibility.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ A Visual Studio solution containing all samples can be found at [Samples.sln](ht
8383
| [Markdown linter](https://github.com/microsoft/VSExtensibility/tree/main/New_Extensibility_Model/Samples/MarkdownLinter) | A complete extension with many moving parts interacting to provide an enhanced experience in the editor for a certain file type. |
8484
| [Project Query](https://github.com/microsoft/VSExtensibility/tree/main/New_Extensibility_Model/Samples/VSProjectQueryAPISample) | Shows several different kinds of project system queries you can make. |
8585
| [Comment remover](https://github.com/microsoft/VSExtensibility/tree/main/New_Extensibility_Model/Samples/CommentRemover) | Shows how to consume [Visual Studio SDK](https://www.nuget.org/packages/Microsoft.VisualStudio.SDK) services through .NET dependency injection and use VisualStudio.Extensibility APIs for commands, prompts and progress report. |
86-
| [RegexMatchDebugVisualizer](https://github.com/microsoft/VSExtensibility/tree/dev/maprospe/vsix_creation/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer) | Shows how to use [Remote UI](./inside-the-sdk/remote-ui.md) to create a [Debugger Visualizer](./debugger-visualizer/debugger-visualizers.md) to visualize regular expression matches that will launch in a modal dialog window. |
87-
| [MemoryStreamDebugVisualizer](https://github.com/microsoft/VSExtensibility/tree/dev/maprospe/vsix_creation/New_Extensibility_Model/Samples/MemoryStreamDebugVisualizer) | Shows how to create a [Debugger Visualizer](./debugger-visualizer/debugger-visualizers.md) to visualize MemoryStream objects that launches in a non-modal tool window. |
86+
| RegexMatchDebugVisualizer | Shows how to use [Remote UI](./inside-the-sdk/remote-ui.md) to create a [Debugger Visualizer](./debugger-visualizer/debugger-visualizers.md) to visualize regular expression matches that will launch in a modal dialog window. |
87+
| MemoryStreamDebugVisualizer | Shows how to create a [Debugger Visualizer](./debugger-visualizer/debugger-visualizers.md) to visualize MemoryStream objects that launches in a non-modal tool window. |
8888
| [RustLanguageServiceProvider](https://github.com/microsoft/VSExtensibility/tree/main/New_Extensibility_Model/Samples/RustLanguageServerProvider) | Shows how to create a Rust language server provider extension that adds Intellisense and tooltips when a rust file is opened. |
8989

9090
## Advanced topics
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Change (Diff) report
3+
description: Change (Diff) report in the Memory Usage tool
4+
services: ""
5+
author: mikejo5000
6+
ms.service: ""
7+
ms.topic: include
8+
ms.date: 02/06/2024
9+
ms.author: mikejo
10+
ms.custom: include file
11+
---
12+
13+
The change report adds columns (marked with **(Diff)**) to the base report that show the difference between the base snapshot value and the comparison snapshot. Here's how a Native Type View diff report might look:
14+
15+
::: moniker range=">=vs-2022"
16+
17+
[![Screenshot of Native Types Diff View.](../media/vs-2022/dbgdiag-mem-native-types-view-diff.png "Native Types Diff View")](../media/vs-2022/dbgdiag-mem-native-types-view-diff.png#lightbox)
18+
19+
::: moniker-end
20+
21+
::: moniker range="vs-2019"
22+
23+
![Screenshot of Native Types Diff View.](../media/vs-2019/dbgdiag-mem-native-types-view-diff.png)
24+
25+
::: moniker-end
26+
27+
The top pane shows the count and size of the types in the snapshot, including the size of all objects that are referenced by the type (**Inclusive Size**).
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Managed Types report
3+
description: Managed Types report in the Memory Usage tool
4+
services: ""
5+
author: mikejo5000
6+
ms.service: ""
7+
ms.topic: include
8+
ms.date: 02/06/2024
9+
ms.author: mikejo
10+
ms.custom: include file
11+
---
12+
13+
Choose the current link of an **Objects (Diff)** cell in the Memory Usage summary table.
14+
15+
::: moniker range=">=vs-2022"
16+
17+
[![Screenshot of managed type report.](../media/vs-2022/dbgdiag-mem-managed-types-report-paths-to-root.png "Managed type report")](../media/vs-2022/dbgdiag-mem-managed-types-report-paths-to-root.png#lightbox)
18+
19+
> [!NOTE]
20+
> For .NET code, the **View Instances** icon (![The instance icon in the Object Type column](../media/dbg-mma-instances-icon.png "DBG_MMA_InstancesIcon")) is only available while using the [debugger-integrated Memory Usage tool](../../profiling/memory-usage.md) or when you open a [heap snapshot](../../debugger/using-dump-files.md) and choose **Debug Managed Memory**.
21+
22+
::: moniker-end
23+
24+
::: moniker range="vs-2019"
25+
26+
![Screenshot of managed type report.](../media/vs-2019/dbgdiag-mem-managed-types-report-paths-to-root.png)
27+
28+
::: moniker-end
29+
30+
The top pane shows the count and size of the types in the snapshot, including the size of all objects that are referenced by the type (**Inclusive Size**).
31+
32+
The **Paths to Root** tree in the bottom pane displays the objects that reference the type selected in the upper pane. The .NET garbage collector cleans up the memory for an object only when the last type that references it has been released.
33+
34+
::: moniker range=">=vs-2022"
35+
36+
The **Referenced Types** tree displays the references that are held by the type selected in the upper pane.
37+
38+
![Screenshot of Referenced Objects report.](../media/vs-2022/dbgdiag-mem-managed-types-report-referenced-types.png)
39+
40+
::: moniker-end
41+
::: moniker range="vs-2019"
42+
43+
The **Referenced Types** tree displays the references that are held by the type selected in the upper pane.
44+
45+
![Screenshot of Referenced Objects report.](../media/vs-2019/dbgdiag-mem-managed-types-report-referenced-types.png)
46+
47+
::: moniker-end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Memory Usage Insights report
3+
description: Memory Usage Insights report in the Memory Usage tool
4+
services: ""
5+
author: mikejo5000
6+
ms.service: ""
7+
ms.topic: include
8+
ms.date: 02/06/2024
9+
ms.author: mikejo
10+
ms.custom: include file
11+
---
12+
13+
For managed memory, the Memory Analysis tool also gives multiple powerful built-in auto insights. Select the **Insights** tab in the Managed types reports and it shows the applicable auto insights like **Duplicate strings**, **Sparse arrays**, and **Event handler leaks**.
14+
15+
[![Screenshot of the insight view in the Memory Usage tool.](../media/vs-2022/dbgdiag-mem-managed-insights.png "Memory Usage insight")](../media/vs-2022/dbgdiag-mem-managed-insights.png#lightbox)
16+
17+
The **Duplicate Strings** section shows the list of strings that get allocated multiple times on the heap. In addition, this section shows the total wasted memory, that is, the (number of instances - 1) times the size of the string.
18+
19+
The **Sparse Arrays** section shows arrays that are mostly filled with zero elements, which can be inefficient in terms of performance and memory usage. The memory analysis tool will automatically detect these arrays and show you how much memory is being wasted due to these zero values.
20+
21+
The **Event Handler Leaks** section, available in Visual Studio 2022 version 17.9 Preview 1, shows potential memory leaks that can occur when one object subscribes to another object's event. If the publisher of the event outlives the subscriber, the subscriber remains alive, even if there are no other references to it. This can lead to memory leaks, where unused memory isn't properly freed, causing the application to use more and more memory over time.
22+
23+
Certain types are known to have fields that can be read to determine the size of the native memory they're holding onto. The **Insights** tab shows fake native memory nodes in the object graph, which are retained by their parent objects such that the UI will recognize them and display their size and reference graph.
24+
25+
[![Screenshot of the native insight view in the Memory Usage tool.](../media/vs-2022/dbgdiag-mem-native-insights.png "native insight view in the Memory Usage tool")](../media/vs-2022/dbgdiag-mem-native-insights.png#lightbox)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Native Types report
3+
description: Native Types report in the Memory Usage tool
4+
services: ""
5+
author: mikejo5000
6+
ms.service: ""
7+
ms.topic: include
8+
ms.date: 02/06/2024
9+
ms.author: mikejo
10+
ms.custom: include file
11+
---
12+
13+
Choose the current link of an **Allocations (Diff)** or **Heap Size (Diff)** cell in the Memory Usage summary table of the **Diagnostic Tools** window.
14+
15+
::: moniker range=">=vs-2022"
16+
17+
[![Screenshot of Native Type View.](../media/vs-2022/dbgdiag-mem-native-types-view.png)](../media/vs-2022/dbgdiag-mem-native-types-view.png#lightbox)
18+
19+
::: moniker-end
20+
::: moniker range="<=vs-2019"
21+
22+
[![Screenshot of Native Type View.](../media/vs-2019/dbgdiag-mem-native-types-view.png)](../media/vs-2019/dbgdiag-mem-native-types-view.png#lightbox)
23+
24+
::: moniker-end
25+
26+
The **Types View** displays the number and size of the types in the snapshot.
27+
28+
::: moniker range=">=vs-2022"
29+
30+
- Choose the **View Instances** icon next to a selected type to display information about the objects of the selected type in the snapshot.
31+
32+
The **Instances** view displays each instance of the selected type. Selecting an instance displays the call stack that resulted in the creation of the instance in the **Allocation Call Stack** pane.
33+
34+
[![Screenshot of the Instances view and Allocation Call Stack pane.](../media/vs-2022/dbgdiag-mem-native-instances.png)](../media/vs-2022/dbgdiag-mem-native-instances.png#lightbox)
35+
36+
::: moniker-end
37+
38+
::: moniker range="<=vs-2019"
39+
40+
- Choose the instances icon (![The instance icon in the Object Type column](../media/dbg-mma-instances-icon.png "DBG_MMA_InstancesIcon")) of a selected type to display information about the objects of the selected type in the snapshot.
41+
42+
The **Instances** view displays each instance of the selected type. Selecting an instance displays the call stack that resulted in the creation of the instance in the **Allocation Call Stack** pane.
43+
44+
![Screenshot of the Instances view and Allocation Call Stack pane.](../media/vs-2019/dbgdiag-mem-native-instances.png)
45+
46+
::: moniker-end
47+
48+
::: moniker range=">=vs-2022"
49+
50+
- Choose **Stacks** to see the allocation stack for the selected type.
51+
52+
[![Screenshot of Stacks view.](../media/vs-2022/dbgdiag-mem-native-stacks-view.png)](../media/vs-2022/dbgdiag-mem-native-stacks-view.png#lightbox)
53+
54+
::: moniker-end
55+
56+
::: moniker range="<=vs-2019"
57+
58+
- Choose **Stacks View** in the **View Mode** list to see the allocation stack for the selected type.
59+
60+
![Screenshot of Stacks view.](../media/vs-2019/dbgdiag-mem-native-stacks-view.png)
61+
62+
::: moniker-end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)