Skip to content

Commit fe16de3

Browse files
authored
Merge pull request #4436 from poppastring/time-travel-debugging-vs2019
Time Travel Debug
2 parents 6b338dc + ba58f20 commit fe16de3

9 files changed

+125
-10
lines changed

docs/debugger/debug-live-azure-kubernetes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ In this tutorial, you will:
2929
3030
## Prerequisites
3131

32-
* Snapshot Debugger for Azure Kubernetes Services is only available for Visual Studio 2019 Enterprise preview or higher with the **Azure development workload**. (Under the **Individual components** tab, you find it under **Debugging and testing** > **Snapshot debugger**.)
32+
* Snapshot Debugger for Azure Kubernetes Services is only available for Visual Studio 2019 Enterprise or higher with the **Azure development workload**. (Under the **Individual components** tab, you find it under **Debugging and testing** > **Snapshot debugger**.)
3333

34-
If it's not already installed, install [Visual Studio 2019 Enterprise preview](https://visualstudio.microsoft.com/vs/preview/).
34+
If it's not already installed, install [Visual Studio 2019 Enterprise](https://visualstudio.microsoft.com/vs/).
3535

3636
* Snapshot collection is available for the following Azure Kubernetes Services web apps:
3737
* ASP.NET Core applications running on .NET Core 2.2 or later on Debian 9.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: "Time Travel Debugging live ASP.NET Azure virtual machines"
3+
description: "Learn how to record and replay live ASP.NET apps on Azure virtual machines using the Snapshot Debugger."
4+
ms.custom: ""
5+
ms.date: "04/11/2019"
6+
ms.topic: "conceptual"
7+
helpviewer_keywords:
8+
- "debugger"
9+
author: "poppastring"
10+
ms.author: "madownie"
11+
manager: andster
12+
monikerRange: '>= vs-2019'
13+
ms.workload:
14+
- "aspnet"
15+
- "azure"
16+
---
17+
# Record and replay live ASP.NET apps on Azure virtual machines using the Snapshot Debugger
18+
19+
The Time Travel Debugging (TTD) preview in Visual Studio Enterprise provides the ability to record a Web app running on a Azure Virtual Machine (VM) and then accurately reconstruct and replay the execution path. TTD integrates with our Snapshot Debugger offering and allows you to rewind and replay each line of code however many times you want, helping you isolate and identify problems that might only occur in production environments.
20+
21+
Capturing a TTD recording will not halt the application, however, recording will add significant overhead to your running process, slowing it down based on factors that include the process size and the number of active threads.
22+
23+
This feature is in preview for the release of Visual Studio 2019 with a go live license.
24+
25+
In this tutorial, you will:
26+
27+
> [!div class="checklist"]
28+
> * Start the Snapshot Debugger with Time Travel Debugging enabled
29+
> * Set a snappoint and Collect a Time Travel recording
30+
> * Start Debugging a Time Travel recording
31+
32+
## Prerequisites
33+
34+
* Time Travel Debugging for Azure Virtual Machines (VM) is only available for Visual Studio 2019 Enterprise or higher with the **Azure development workload**. (Under the **Individual components** tab, you find it under **Debugging and testing** > **Snapshot debugger**.)
35+
36+
If it's not already installed, install [Visual Studio 2019 Enterprise](https://visualstudio.microsoft.com/vs/).
37+
38+
* Time Travel Debugging is available for the following Azure VM web apps:
39+
* ASP.NET applications (AMD64) running on .NET Framework 4.8 or later.
40+
41+
## Open your project and start the Snapshot Debugger with Time Travel Debugging enabled
42+
43+
1. Open the project that you would like to Collect a Time Travel recording.
44+
45+
> [!IMPORTANT]
46+
> To start TTD, you need to open the *same version of source code* that is published to your Azure VM service.
47+
48+
1. Choose **Debug > Attach Snapshot Debugger...**. Select the Azure VM your web app is deployed to and an Azure storage account. Select the **Enable the Time Travel Debugging** preview option and then click **Attach**.
49+
50+
![Select Azure Resource](../debugger/media/time-travel-debugging-select-azure-resource-vm.png)
51+
52+
> [!IMPORTANT]
53+
> The first time you select **Attach Snapshot Debugger** for your VM, IIS is automatically restarted.
54+
55+
The metadata for the **Modules** will not initially be activated, navigate to the web app and the **Start Collection** button will become active. Visual Studio is now in snapshot debugging mode.
56+
57+
![Snapshot debugging mode](../debugger/media/snapshot-message.png)
58+
59+
> [!NOTE]
60+
> The Application Insights site extension also supports Snapshot Debugging. If you encounter a "site extension out of date" error message, see [troubleshooting tips and known issues for snapshot debugging](../debugger/debug-live-azure-apps-troubleshooting.md) for upgrading details.
61+
62+
The **Modules** window shows you when all the modules have loaded for the Azure VM (choose **Debug > Windows > Modules** to open this window).
63+
64+
![Check the Modules window](../debugger/media/snapshot-modules.png)
65+
66+
## Set a snappoint and Collect a Time Travel recording
67+
68+
1. In the code editor, click the left gutter in a method you are interested in to set a snappoint. Make sure it is code that you know will execute.
69+
70+
![Set a snappoint](../debugger/media/time-travel-debugging-set-snappoint-settings.png)
71+
72+
1. Right-click the snappoint icon (the hollow ball) and choose **Actions**. In the Snapshot Settings window click the **Action** check box. Then click the **Collect a time travel trace to the end of this method** check box.
73+
74+
![Collect a time travel trace to the end of the method](../debugger/media/time-travel-debugging-set-snappoint-action.png)
75+
76+
1. Click **Start Collection** to turn on the snappoint.
77+
78+
![Turn on the snappoint](../debugger/media/snapshot-start-collection.png)
79+
80+
## Take a snapshot
81+
82+
When a snappoint is turned on, it will capture a snapshot whenever the line of code where the snappoint is placed executes. This execution can be caused by a real request on your server. To force your snappoint to hit, go to the browser view of your web site and take any actions required that cause your snappoint to be hit.
83+
84+
## Start Debugging a Time Travel recording
85+
86+
1. When the snappoint is hit, a snapshot appears in the Diagnostic Tools window. To open this window, choose **Debug > Windows > Show Diagnostic Tools**.
87+
88+
![Open a snappoint](../debugger/media/snapshot-diagsession-window.png)
89+
90+
1. Click the View Snapshot link to open the Time Travel recording in the code editor.
91+
92+
You can execute every line of code recorded by the TTD by using the **Continue** and **Reverse Continue** buttons. Additionally the the Debug toolbar can be used to **Show Next Statement**, **Step Into**, **Step Over**, **Step Out**, **Step Back Into**, **Step Back Over**, **Step Back Out**.
93+
94+
![Start Debugging](../debugger/media/time-travel-debugging-step-commands.png)
95+
96+
You can also use the **Locals**, **Watches**, and **Call Stack** windows, and also evaluate expressions.
97+
98+
![Inspect snapshot data](../debugger/media/time-travel-debugging-start-debugging.png)
99+
100+
The website itself is still live and end users aren't impacted by any subsequent TTD activity. Only one snapshot is captured per snappoint by default: after a snapshot is captured the snappoint turns off. If you want to capture another snapshot at the snappoint, you can turn the snappoint back on by clicking **Update Collection**.
101+
102+
**Need help?** See the [Troubleshooting and known issues](../debugger/debug-live-azure-apps-troubleshooting.md) and [FAQ for snapshot debugging](../debugger/debug-live-azure-apps-faq.md) pages.
103+
104+
## Set a conditional snappoint
105+
106+
If it is difficult to recreate a particular state in your app, consider whether the use of a conditional snappoint can help. Conditional snappoints help you avoid collecting a Time Travel recording until the app enters a desired state, such as when a variable has a particular value that you want to inspect. [You can set conditions using expressions, filters, or hit counts](../debugger/debug-live-azure-apps-troubleshooting.md).
107+
108+
## Next steps
109+
110+
In this tutorial, you've learned how to collect a Time Travel recording for Azure Virtual Machines. You may want to read more details about Snapshot Debugger.
111+
112+
> [!div class="nextstepaction"]
113+
> [FAQ for snapshot debugging](../debugger/debug-live-azure-apps-faq.md)

docs/debugger/debug-live-azure-virtual-machines.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ In this tutorial, you will:
2929
3030
## Prerequisites
3131

32-
* Snapshot Debugger for Azure Virtual Machines (VM) and Azure Virtual Machine Scale Sets (VMSS) is only available for Visual Studio 2019 Enterprise preview or higher with the **Azure development workload**. (Under the **Individual components** tab, you find it under **Debugging and testing** > **Snapshot debugger**.)
32+
* Snapshot Debugger for Azure Virtual Machines (VM) and Azure Virtual Machine Scale Sets is only available for Visual Studio 2019 Enterprise or higher with the **Azure development workload**. (Under the **Individual components** tab, you find it under **Debugging and testing** > **Snapshot debugger**.)
3333

34-
If it's not already installed, install [Visual Studio 2019 Enterprise preview](https://visualstudio.microsoft.com/vs/preview/).
34+
If it's not already installed, install [Visual Studio 2019 Enterprise](https://visualstudio.microsoft.com/vs/).
3535

36-
* Snapshot collection is available for the following Azure VM/VMSS web apps:
36+
* Snapshot collection is available for the following Azure Virtual Machines\Virtual Machine Scale Sets web apps:
3737
* ASP.NET applications running on .NET Framework 4.6.1 or later.
3838
* ASP.NET Core applications running on .NET Core 2.0 or later on Windows.
3939

@@ -42,27 +42,27 @@ In this tutorial, you will:
4242
1. Open the project you would like to snapshot debug.
4343

4444
> [!IMPORTANT]
45-
> To snapshot debug, you need to open the *same version of source code* that is published to your Azure VM/VMSS service.
45+
> To snapshot debug, you need to open the *same version of source code* that is published to your Azure Virtual Machine\Virtual Machine Scale Set service.
4646
47-
1. Choose **Debug > Attach Snapshot Debugger...**. Select the Azure VM/VMSS your web app is deployed to and an Azure storage account, and then click **Attach**.
47+
1. Choose **Debug > Attach Snapshot Debugger...**. Select the Azure Virtual Machine\Virtual Machine Scale Set your web app is deployed to and an Azure storage account, and then click **Attach**.
4848

4949
![Launch the snapshot debugger from the Debug menu](../debugger/media/snapshot-debug-menu-attach.png)
5050

5151
![Select Azure Resource](../debugger/media/snapshot-select-azure-resource-vm.png)
5252

5353
> [!IMPORTANT]
5454
> The first time you select **Attach Snapshot Debugger** for your VM, IIS is automatically restarted.
55-
> The first time you select **Attach Snapshot Debugger** for your VMSS, requires the manual upgrade of each instance of the VMSS.
55+
> The first time you select **Attach Snapshot Debugger** for your Virtual Machine Scale Sets, requires the manual upgrade of each instance of the Virtual Machine Scale Sets.
5656
5757
The metadata for the **Modules** will not initially be activated, navigate to the web app and the **Start Collection** button will become active. Visual Studio is now in snapshot debugging mode.
5858

5959
![Snapshot debugging mode](../debugger/media/snapshot-message.png)
6060

6161
> [!NOTE]
6262
> The Application Insights site extension also supports Snapshot Debugging. If you encounter a "site extension out of date" error message, see [troubleshooting tips and known issues for snapshot debugging](../debugger/debug-live-azure-apps-troubleshooting.md) for upgrading details.
63-
> For VMSS the user is required to manually upgrade the instances in their VMSS after attaching the Snapshot Debugger for the first time.
63+
> For VMSS the user is required to manually upgrade the instances in their Virtual Machine Scale Sets after attaching the Snapshot Debugger for the first time.
6464
65-
The **Modules** window shows you when all the modules have loaded for the Azure VM/VMSS (choose **Debug > Windows > Modules** to open this window).
65+
The **Modules** window shows you when all the modules have loaded for the Azure Virtual Machine\Virtual Machine Scale Set (choose **Debug > Windows > Modules** to open this window).
6666

6767
![Check the Modules window](../debugger/media/snapshot-modules.png)
6868

Loading
Loading
Loading
Loading
Loading

docs/debugger/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@
371371
href: debug-live-azure-apps-faq.md
372372
- name: Troubleshooting snapshot debugging
373373
href: debug-live-azure-apps-troubleshooting.md
374+
- name: Time Travel Debugging live Azure virtual machine app
375+
href: debug-live-azure-virtual-machines-time-travel-debugging.md
374376
- name: Debug specific application types
375377
href: debugging-applications.md
376378
items:

0 commit comments

Comments
 (0)