Skip to content

Commit 122685f

Browse files
committed
Merge branch 'mikejo-snap' of https://github.com/Microsoft/visualstudio-docs-pr into mikejo-snap
2 parents beb6e95 + 4956cbe commit 122685f

File tree

1 file changed

+50
-21
lines changed

1 file changed

+50
-21
lines changed

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

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,58 +32,63 @@ translation.priority.mt:
3232
---
3333
# Debug live ASP.NET apps running in Azure App Service
3434

35-
The Snapshot Debugger takes a snapshot of your in-production Azure App Service when code that you are interested in executes. To instruct the debugger to take a snapshot, you set snappoints and logpoints in your code. The debugger lets you see exactly what went wrong, without impacting traffic of your production application. The Snapshot Debugger can help you to dramatically reduce the time it takes to resolve issues that occur in production environments.
35+
The Snapshot Debugger takes a snapshot of your in-production apps when code that you are interested in executes. To instruct the debugger to take a snapshot, you set snappoints and logpoints in your code. The debugger lets you see exactly what went wrong, without impacting traffic of your production application. The Snapshot Debugger can help you dramatically reduce the time it takes to resolve issues that occur in production environments.
3636

37-
Snapshot collection is available for the following web aps running in Azure App Service:
37+
Snapshot collection is available for the following web apps running in Azure App Service:
3838

39-
- .NET Framework and ASP.NET applications running .NET Framework 4.5 or later.
40-
- .NET Core 2.0 and ASP.NET Core 2.0 applications running on Windows.
39+
- ASP.NET applications running on .NET Framework 4.6.1 or later.
40+
- ASP.NET Core applications running on .NET Core 2.0 or later on Windows.
41+
42+
Additionally, the Snapshot Debugger is only available for **Visual Studio Enterprise**.
4143

4244
> [!NOTE]
43-
> With some additional configuration, Application Insights can automatically capture snapshots when your app hits an exception. For more information, see [Debug snapshots on exceptions in .NET apps](/azure/application-insights/app-insights-snapshot-debugger). Application Insights supports Service Fabric apps in addition to App Service.
45+
> With some additional configuration, Application Insights can automatically capture snapshots when your app hits an exception. For more information, see [Debug snapshots on exceptions in .NET apps](/azure/application-insights/app-insights-snapshot-debugger). Application Insights supports Service Fabric apps in addition to Azure App Service.
4446
4547
## Start the Snapshot Debugger
4648

47-
1. Install the [Visual Studio 15.4 Preview](microsoft.com) or later.
49+
1. Install the [Visual Studio Enterprise 15.4 Preview](microsoft.com) or later.
4850

49-
2. Install the [Snapshot Debugger extension](https://aka.ms/snapshotdebugger).
51+
2. Install the [Snapshot Debugger extension](https://aka.ms/snappoint) for Visual Studio. This extension will enable you to set snappoints and logpoints against apps running in Azure App Services.
5052

5153
3. Open the project you would like to snapshot debug.
5254

5355
> [!NOTE]
54-
> In order to snapshot debug, you need to open the same version of source code that is published to Azure App Services.
56+
> In order to snapshot debug, you need to open the **same version of source code** that is published to your Azure Azure App Service.
5557
56-
4. In the Cloud Explorer, right click the App Service your project is deployed to and select **Attach Snapshot Debugger** to start the Snapshot Debugger.
58+
4. In the Cloud Explorer, right click the Azure App Service your project is deployed to and select **Attach Snapshot Debugger** to start the Snapshot Debugger.
5759

5860
![Launch the snapshot debugger](../debugger/media/snapshot-launch.png "Launch the snapshot debugger")
5961

62+
> [!NOTE]
63+
> The first time you select **Attach Snapshot Debugger**, you will be prompted to install the Snapshot Debugger on your Azure App Service. This installation requires a restart of your Azure App Service.
64+
6065
Visual Studio is now in snapshot debugging mode.
6166

6267
![Snapshot debugging mode](../debugger/media/snapshot-message.png "Snapshot debugging mode")
6368

64-
The **Modules** window shows you when all the modules have loaded for the App Service (choose **Debug / Windows / Modules** to open this window).
69+
The **Modules** window shows you when all the modules have loaded for the Azure App Service (choose **Debug / Windows / Modules** to open this window).
6570

6671
![Check the Modules window](../debugger/media/snapshot-modules.png "Check the Modules window")
6772

6873
## Set a snappoint
6974

70-
1. In the code editor, click a line of code in the left gutter to set a snappoint (make sure it is code that you know will execute).
75+
1. In the code editor, click the left gutter next to a line of code you are interested in to set a snappoint (make sure it is code that you know will execute).
7176

7277
![Set a snappoint](../debugger/media/snapshot-set-snappoint.png "Set a snappoint")
7378

7479
> [!NOTE]
75-
> Unlike breakpoints, snappoints do not halt the application when hit. Typically, a snapshot taken from a snappoint only increases overhead by 10-20 ms. A shadow copy is created and debugging occurs against the shadow copy.
80+
> Unlike breakpoints, snappoints do not halt the application when hit. Typically, capturing a snapshot at a snappoint takes 10-20 milliseconds.
7681
7782
2. Click **Start Collection** to turn on the snappoint.
7883

7984
![Turn on the snappoint](../debugger/media/snapshot-start-collection.png "Turn on the snappoint")
8085

8186
> [!TIP]
82-
> You can place multiple snappoints in the same method. When snapshots are captured on a server under load, all snappoints are captured from the same user session.
87+
> You cannot step when viewing a snapshot, but you can place multiple snappoints in your code to follow execution at different lines of code. If you have multiple snappoints in your code, the Snapshot Debugger ensures that the corresponding snapshots are from the same end user session, even if there are multiple users hitting your app.
8388
8489
## Take a snapshot
8590

86-
When a snappoint is turned on, it will capture a snapshot whenever the line of code where the snappoint is placed is executed. This execution can be caused by a real request on your server. To force the code where you set the snappoint to run, you can also go to the browser view of your web site and take any actions required that will cause your snappoint to be hit.
91+
When a snappoint is turned on, it will capture a snapshot whenever the line of code where the snappoint is placed is executed. This execution can be caused by a real request on your server. To force your snappoint to hit, you can also go to the browser view of your web site and take any actions required that will cause your snappoint to be hit.
8792

8893
## Inspect snapshot data
8994

@@ -95,14 +100,18 @@ When a snappoint is turned on, it will capture a snapshot whenever the line of c
95100

96101
![Inspect snapshot data](../debugger/media/snapshot-inspect-data.png "Inspect snapshot data")
97102

98-
From this view, you can hover over variables to view DataTips, use the **Locals** and **Watches** windows, and also evaluate expressions.
103+
From this view, you can hover over variables to view DataTips, use the **Locals**, **Watches**, and **Call Stack** windows, and also evaluate expressions.
99104

100105
> [!NOTE]
101106
> The website itself is still live and end users are not impacted.
102107
108+
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**.
109+
110+
You can also add more snappoints to your app and turn them on with the **Update Collection** button.
111+
103112
## Set a conditional snappoint
104113

105-
If it is difficult to recreate a particular state in your app, consider whether the use of a conditional snappoint can help. You can use conditional snappoints to avoid taking a snapshot until the app enters a desired state (such as a state in which a variable is storing bad data). You can set conditions using expressions, filters, hit counts, and so on.
114+
If it is difficult to recreate a particular state in your app, consider whether the use of a conditional snappoint can help. You can use conditional snappoints to avoid taking a snapshot until the app enters a desired state (such as a state in which a variable has a particular value you're interested in). You can set conditions using expressions, filters, or hit counts.
106115

107116
#### To create a conditional snappoint
108117

@@ -118,23 +127,43 @@ If it is difficult to recreate a particular state in your app, consider whether
118127

119128
## Set a logpoint
120129

121-
In addition to taking a snapshot when a snappoint is hit, you can also configure a snappoint to log a message (that is, create a logpoint). You can set logpoints without having to redploy your app. Logpoints are virtually executed and cause no impact and no side effects to your running application.
130+
In addition to taking a snapshot when a snappoint is hit, you can also configure a snappoint to log a message (that is, create a logpoint). You can set logpoints without having to redploy your app. Logpoints are virtually executed and cause no impact or side effects to your running application.
122131

123132
#### To create a logpoint
124133

125-
1. Right-click a snappoint icon (the hollow ball) and choose **Settings**.
134+
1. Right-click a snappoint icon (the blue hexagon) and choose **Settings**.
126135

127136
2. In the snappoint settings window, select **Actions**.
128137

129138
![Create a logpoint](../debugger/media/snapshot-logpoint.png "Create a logpoint")
130139

131-
3. Select options for output, including the messsage string (which can include variables).
140+
3. In the Message field, you can enter the new log message you want to log. You can also evaluate variables in your log message by placing them inside curly braces.
132141

133-
If you choose **Send to Output Window**, when the logpoint is hit the message will appear in the Diagnostic Tools window.
142+
If you choose **Send to Output Window**, when the logpoint is hit, the message will appear in the Diagnostic Tools window.
134143

135144
![Logpoint data in the .diagsession window](../debugger/media/snapshot-logpoint-output.png "Logpoint data in the .diagsession window")
136145

137-
If you choose **Send to application log**, when the logpoint is hit the message will appear anywhere that you can see see messages from `System.Diagnostics.Trace` (or `ILogger` in .NET Core), such as [App Insights](/azure/application-insights/app-insights-asp-net-trace-logs).
146+
If you choose **Send to application log**, when the logpoint is hit, the message will appear anywhere that you can see messages from `System.Diagnostics.Trace` (or `ILogger` in .NET Core), such as [App Insights](/azure/application-insights/app-insights-asp-net-trace-logs).
147+
148+
## Frequently Asked Questions
149+
150+
#### What is the performance cost of taking a snapshot?
151+
When the Snapshot Debugger captures a snapshot of your app, it is forking the app's process and suspending the forked copy. When you debug a snapshot, you are debugging against the forked copy of the process. This process takes only 10-20 milliseconds but does not copy the full heap of the app; instead, it copies only the page table and sets pages to copy on write. If some of your app's objects on the heap change, their respective pages are then copied. Each snapshot therefore has a very small in-memory cost (on the order of hundreds of kilobytes for most apps).
152+
153+
#### What happens if I have a scaled-out Azure App Service (multiple instances of my app)?
154+
When you have multiple instances of your app, snappoints get applied to every single instance. Only the first snappoint to hit with the condtions specified will create a snapshot. If you have multiple snappoints, subsequent snapshots will come from the same instance that created the first snapshot. Logpoints sent to the output window will only show messages from one instance, while logpoints sent to application logs will send messages from every instance.
155+
156+
#### How does the Snapshot Debugger load symbols?
157+
The Snapshot Debugger requires you to have the correct symbols corresponding to your application either locally or deployed to your Azure App Service (embedded PDBs are currently not supported). The Snapshot Debugger will automatically download symbols from your Azure App Service. As of Visual Studio 2017 (version 15.2), deploying to Azure App Service will also deploy your app's symbols.
158+
159+
#### Does the Snapshot Debugger work against release builds of my application?
160+
Yes - the Snapshot Debugger is intended to work against release builds. When a snappoint is placed in a function, we temporarily recompile that function back to a debug version and making it debuggable. When you stop the Snapshot Debugger, the functions are returned to their release build.
161+
162+
#### Can logpoints cause side effects in my production application?
163+
No - any log messages you add to your app are evaluated virtually. They cannot cause any side effects in your application. However, some native properties may not be accessible with logpoints.
164+
165+
#### Does the Snapshot Debugger work if my server is under load?
166+
Yes - Snapshot Debugging can work for servers under load. The Snapshot Debugger will throttle and not capture snapshots in situations where there is a low amount of free memory on your server.
138167

139168
## See Also
140169
[Debug Azure apps](../debugger/debug-azure-apps.md)

0 commit comments

Comments
 (0)