/
debug-live-azure-apps-faq.yml
215 lines (161 loc) · 12.9 KB
/
debug-live-azure-apps-faq.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
### YamlMime:FAQ
metadata:
title: "FAQ for snapshot debugging | Microsoft Docs"
description: Review a list of frequently asked questions (FAQ) that might come up when debugging live Azure applications using the Snapshot Debugger in Visual Studio.
ms.date: "11/07/2017"
ms.topic: faq
helpviewer_keywords:
- "debugger"
ms.assetid: 944f1eb0-a74b-4d28-ae2b-a370cd869add
author: "mikejo5000"
ms.author: "mikejo"
manager: mijacobs
ms.workload:
- "multiple"
ms.subservice: debug-diagnostics
title: Frequently Asked Questions for snapshot debugging in Visual Studio
summary: Here is a list of questions that might come up when debugging live Azure applications using the Snapshot Debugger.
sections:
- name: General
questions:
- question: |
What is the performance cost of taking a snapshot?
answer: |
When the Snapshot Debugger captures a snapshot of your app, it forks the app's process and suspends the forked copy. When you debug a snapshot, you're debugging against the forked copy of the process. This process takes only 10-20 milliseconds but doesn't 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. That's why each snapshot has a small in-memory cost (on the order of hundreds of kilobytes for most apps).
- question: |
What happens if I have a scaled-out Azure App Service (multiple instances of my app)?
answer: |
When you have multiple instances of your app, snappoints get applied to every single instance. Only the first snappoint to hit with the conditions specified creates a snapshot. If you have multiple snappoints, later snapshots 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 send messages from every instance.
- question: |
How does the Snapshot Debugger load symbols?
answer: |
The Snapshot Debugger requires that you have the matching symbols for your application either local or deployed to your Azure App Service. (Embedded PDBs are currently not supported.) The Snapshot Debugger automatically downloads symbols from your Azure App Service. Starting with Visual Studio 2017 version 15.2, deploying to Azure App Service also deploys your app's symbols.
- question: |
Does the Snapshot Debugger work against release builds of my application?
answer: |
Yes - the Snapshot Debugger is intended to work against release builds. When a snappoint is placed in a function, the function is recompiled back to a debug version, making it debuggable. Stopping the Snapshot Debugger returns functions to the version of the release build.
- question: |
Can logpoints cause side effects in my production application?
answer: |
No - any log messages you add to your app are evaluated virtually. They can't cause any side effects in your application. However, some native properties may not be accessible with logpoints.
- question: |
Does the Snapshot Debugger work if my server is under load?
answer: |
Yes, snapshot debugging can work for servers under load. The Snapshot Debugger throttles and doesn't capture snapshots in situations where there's a low amount of free memory on your server.
- question: |
How do I uninstall the Snapshot Debugger?
answer: |
You can uninstall the Snapshot Debugger site extension on your App Service with the following steps:
1. Turn off your App Service either through the Cloud Explorer in Visual Studio or the Azure portal.
1. Navigate to your App Service's Kudu site (that is, yourappservice.**scm**.azurewebsites.net) and navigate to **Site extensions**.
1. Click the X on the Snapshot Debugger site extension to remove it.
- question: |
Why are ports opened during a Snapshot Debugger session?
answer: |
Snapshot Debugger needs to open a set of ports in order to debug the snapshots taken in Azure, these are the same ports required for remote debugging. [You can find the list of ports here](../debugger/remote-debugger-port-assignments.md).
- question: |
How do I disable the Remote Debugger extension?
answer: |
For App Services:
1. Disable Remote Debugger extension via the Azure portal for your App Service.
2. Azure portal > your Application Service resource blade > *Application Settings*
3. Navigate to the *Debugging* section and click the *Off* button for *Remote debugging*.
For AKS:
1. Update your Dockerfile to remove the sections corresponding to the [Visual Studio Snapshot Debugger on Docker images](https://github.com/Microsoft/vssnapshotdebugger-docker).
2. Rebuild and redeploy the modified Docker image.
For virtual machine/virtual machine scale sets remove the Remote Debugger extension, Certificates, KeyVaults and InBound NAT pools as follows:
1. Remove Remote Debugger extension
There are several ways to disable the Remote Debugger for virtual machines and virtual machine scale sets:
- Disable the Remote Debugger through Cloud Explorer
- Cloud Explorer > your virtual machine resource > Disable Debugging (Disabling Debugging does not exist for virtual machine scale set on Cloud Explorer).
- Disable the Remote Debugger with PowerShell Scripts/Cmdlets
For virtual machine:
```powershell
Remove-AzVMExtension -ResourceGroupName $rgName -VMName $vmName -Name Microsoft.VisualStudio.Azure.RemoteDebug.VSRemoteDebugger
```
For virtual machine scale sets:
```powershell
$vmss = Get-AzVmss -ResourceGroupName $rgName -VMScaleSetName $vmssName
$extension = $vmss.VirtualMachineProfile.ExtensionProfile.Extensions | Where {$_.Name.StartsWith('VsDebuggerService')} | Select -ExpandProperty Name
Remove-AzVmssExtension -VirtualMachineScaleSet $vmss -Name $extension
```
- Disable the Remote Debugger through the Azure portal
- Azure portal > your virtual machine/virtual machine scale sets resource blade > Extensions
- Uninstall Microsoft.VisualStudio.Azure.RemoteDebug.VSRemoteDebugger extension
> [!NOTE]
> Virtual machine scale sets - The portal does not allow removing the DebuggerListener ports. You will need to use Azure PowerShell. See below for details.
2. Remove Certificates and Azure KeyVault
When installing the Remote Debugger extension for virtual machine or virtual machine scale sets, both client and server certificates are created to authenticate the Visual Studio client with the Azure Virtual Machine/virtual machine scale sets resources.
- The Client Cert
This cert is a self-signed certificate located in Cert:/CurrentUser/My/
```
Thumbprint Subject
---------- -------
1234123412341234123412341234123412341234 CN=ResourceName
```
One way to remove this certificate from your machine is via PowerShell
```powershell
$ResourceName = 'ResourceName' # from above
Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -match $ResourceName} | Remove-Item
```
- The Server Certificate
- The corresponding server certificate thumbprint is deployed as a secret to Azure KeyVault. Visual Studio will attempt to find or create a KeyVault with prefix MSVSAZ* in the region corresponding to the virtual machine or virtual machine scale sets resource. All virtual machine or virtual machine scale sets resources deployed to that region therefore will share the same KeyVault.
- To delete the server certificate thumbprint secret, go to the Azure portal and find the MSVSAZ* KeyVault in the same region that's hosting your resource. Delete the secret which should be labeled `remotedebugcert<<ResourceName>>`
- You will also need to delete the server secret from your resource via PowerShell.
For virtual machines:
```powershell
$vm.OSProfile.Secrets[0].VaultCertificates.Clear()
Update-AzVM -ResourceGroupName $rgName -VM $vm
```
For virtual machine scale sets:
```powershell
$vmss.VirtualMachineProfile.OsProfile.Secrets[0].VaultCertificates.Clear()
Update-AzVmss -ResourceGroupName $rgName -VMScaleSetName $vmssName -VirtualMachineScaleSet $vmss
```
3. Remove all DebuggerListener InBound NAT pools (virtual machine scale set only)
The Remote Debugger introduces DebuggerListener in-bound NAT pools that are applied to your scaleset's load balancer.
```powershell
$inboundNatPools = $vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations.IpConfigurations.LoadBalancerInboundNatPools
$inboundNatPools.RemoveAll({ param($pool) $pool.Id.Contains('inboundNatPools/DebuggerListenerNatPool-') }) | Out-Null
if ($LoadBalancerName)
{
$lb = Get-AzLoadBalancer -ResourceGroupName $ResourceGroup -name $LoadBalancerName
$lb.FrontendIpConfigurations[0].InboundNatPools.RemoveAll({ param($pool) $pool.Id.Contains('inboundNatPools/DebuggerListenerNatPool-') }) | Out-Null
Set-AzLoadBalancer -LoadBalancer $lb
}
```
- question: |
How do I disable Snapshot Debugger?
answer: |
For App Service:
1. Disable Snapshot Debugger via the Azure portal for your App Service.
2. Azure portal > your Application Service resource blade > *Application Settings*
3. Delete the following App settings in the Azure portal and save your changes.
- INSTRUMENTATIONENGINE_EXTENSION_VERSION
- SNAPSHOTDEBUGGER_EXTENSION_VERSION
> [!WARNING]
> Any changes to Application Settings will initiate an app restart. For more information about Application Settings, see [Configure an App Service app in the Azure portal](/azure/app-service/web-sites-configure).
For AKS:
1. Update your Dockerfile to remove the sections corresponding to the [Visual Studio Snapshot Debugger on Docker images](https://github.com/Microsoft/vssnapshotdebugger-docker).
2. Rebuild and redeploy the modified Docker image.
For virtual machine/virtual machine scale sets:
There are several ways to disable the Snapshot Debugger:
- Cloud Explorer > your virtual machine/virtual machine scale set resource > Disable Diagnostics
- Azure portal > your virtual machine/virtual machine scale set resource blade > Extensions > Uninstall Microsoft.Insights.VMDiagnosticsSettings extension
- PowerShell Cmdlets from [Az PowerShell](/powershell/azure/overview)
Virtual machine:
```powershell
Remove-AzVMExtension -ResourceGroupName $rgName -VMName $vmName -Name Microsoft.Insights.VMDiagnosticsSettings
```
Virtual machine scale sets:
```powershell
$vmss = Get-AzVmss -ResourceGroupName $rgName -VMScaleSetName $vmssName
Remove-AzVmssExtension -VirtualMachineScaleSet $vmss -Name Microsoft.Insights.VMDiagnosticsSettings
```
additionalContent: |
## See also
- [Debugging in Visual Studio](../debugger/index.yml)
- [Debug live ASP.NET apps using the Snapshot Debugger](../debugger/debug-live-azure-applications.md)
- [Debug live ASP.NET Azure Virtual Machines\Virtual Machines scale sets using the Snapshot Debugger](../debugger/debug-live-azure-virtual-machines.md)
- [Debug live ASP.NET Azure Kubernetes using the Snapshot Debugger](../debugger/debug-live-azure-kubernetes.md)
- [Troubleshooting and known issues for snapshot debugging](../debugger/debug-live-azure-apps-troubleshooting.md)