You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Communication Chat | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Communication.Chat/1.3.0)|[docs](/dotnet/api/overview/azure/Communication.Chat-readme)| GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Chat_1.3.0/sdk/communication/Azure.Communication.Chat/)|
15
+
| Communication Chat | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Communication.Chat/1.3.1)|[docs](/dotnet/api/overview/azure/Communication.Chat-readme)| GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Chat_1.3.1/sdk/communication/Azure.Communication.Chat/)|
16
16
| Communication Common | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Communication.Common/1.3.0)<br>NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Common/2.0.0-beta.1)|[docs](/dotnet/api/overview/azure/Communication.Common-readme)| GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_1.3.0/sdk/communication/Azure.Communication.Common/)<br>GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_2.0.0-beta.1/sdk/communication/Azure.Communication.Common/)|
17
17
| Communication Email | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Email/1.0.1)<br>NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Email/1.1.0-beta.1)|[docs](/dotnet/api/overview/azure/Communication.Email-readme)| GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.0.1/sdk/communication/Azure.Communication.Email/)<br>GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.1.0-beta.1/sdk/communication/Azure.Communication.Email/)|
18
18
| Communication Identity | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Communication.Identity/1.3.1)|[docs](/dotnet/api/overview/azure/Communication.Identity-readme)| GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Identity_1.3.1/sdk/communication/Azure.Communication.Identity/)|
@@ -39,7 +39,7 @@
39
39
| Digital Twins | NuGet [1.4.0](https://www.nuget.org/packages/Azure.DigitalTwins.Core/1.4.0)|[docs](/dotnet/api/overview/azure/DigitalTwins.Core-readme)| GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.DigitalTwins.Core_1.4.0/sdk/digitaltwins/Azure.DigitalTwins.Core/)|
| Communication Chat | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Communication.Chat/1.3.0)|[docs](/dotnet/api/overview/azure/Communication.Chat-readme)| GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Chat_1.3.0/sdk/communication/Azure.Communication.Chat/)|
15
+
| Communication Chat | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Communication.Chat/1.3.1)|[docs](/dotnet/api/overview/azure/Communication.Chat-readme)| GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Chat_1.3.1/sdk/communication/Azure.Communication.Chat/)|
16
16
| Communication Common | NuGet [1.3.0](https://www.nuget.org/packages/Azure.Communication.Common/1.3.0)<br>NuGet [2.0.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Common/2.0.0-beta.1)|[docs](/dotnet/api/overview/azure/Communication.Common-readme)| GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_1.3.0/sdk/communication/Azure.Communication.Common/)<br>GitHub [2.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_2.0.0-beta.1/sdk/communication/Azure.Communication.Common/)|
17
17
| Communication Email | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Email/1.0.1)<br>NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Communication.Email/1.1.0-beta.1)|[docs](/dotnet/api/overview/azure/Communication.Email-readme)| GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.0.1/sdk/communication/Azure.Communication.Email/)<br>GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Email_1.1.0-beta.1/sdk/communication/Azure.Communication.Email/)|
18
18
| Communication Identity | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Communication.Identity/1.3.1)|[docs](/dotnet/api/overview/azure/Communication.Identity-readme)| GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Identity_1.3.1/sdk/communication/Azure.Communication.Identity/)|
@@ -40,7 +40,7 @@
40
40
| Digital Twins | NuGet [1.4.0](https://www.nuget.org/packages/Azure.DigitalTwins.Core/1.4.0)|[docs](/dotnet/api/overview/azure/DigitalTwins.Core-readme)| GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.DigitalTwins.Core_1.4.0/sdk/digitaltwins/Azure.DigitalTwins.Core/)|
Copy file name to clipboardExpand all lines: docs/core/diagnostics/debug-stackoverflow.md
+23-8Lines changed: 23 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ ms.date: 8/22/2024
6
6
---
7
7
# Debug StackOverflow errors
8
8
9
-
A <xref:System.StackOverflowException> is thrown when the execution stack overflows because it contains too many nested method calls.
9
+
A <xref:System.StackOverflowException> is thrown when the execution stack overflows because it contains too many nested method calls. Very often this occurs because methods are calling each other [recursively](https://wikipedia.org/wiki/Recursion_(computer_science)).
10
10
11
11
For example, suppose you have an app as follows:
12
12
@@ -39,12 +39,15 @@ Stack overflow.
39
39
<this output repeats many more times>
40
40
````
41
41
42
-
Often just seeing this callstack is enough to identify the problematic repeating method and locate the source code logic that is causing the recursive calls. However if the problem is still unclear you can debug further.
42
+
When you see the program exit with output like this, you can find the source code for the repeating method(s) and investigate the logic that causes the large number of calls.
43
43
44
-
> [!NOTE]
45
-
> This article describes how to debug a stack overflow with lldb on Linux. If you are running on Windows, we suggest debugging the app with [Visual Studio](/visualstudio/debugger/what-is-debugging) or [Visual Studio Code](https://code.visualstudio.com/Docs/editor/debugging).
44
+
## Using the debugger
46
45
47
-
## Example
46
+
Often just seeing this callstack on the console above is enough to identify the problematic code. However if the problem is still unclear you can debug further.
47
+
48
+
### [Linux](#tab/linux)
49
+
50
+
This example creates a core dump when the StackOverflowException occurs, then loads the dump into [lldb](https://lldb.llvm.org/) (a common Linux command-line debugger) and debugs it.
48
51
49
52
1. Run the app with it configured to collect a dump on crash
50
53
@@ -64,7 +67,7 @@ Often just seeing this callstack is enough to identify the problematic repeating
64
67
dotnet-sos install
65
68
````
66
69
67
-
3. Debug the dump in lldb to see the failing stack
70
+
3. Open the dump in lldb and use the `bt` (backtrace) command to display the stack.
68
71
69
72
````
70
73
lldb --core /temp/coredump.6412
@@ -82,7 +85,7 @@ Often just seeing this callstack is enough to identify the problematic repeating
82
85
...
83
86
````
84
87
85
-
4. The top frame `0x00007f59b40900cc` is repeated several times. Use the [SOS](sos-debugging-extension.md) `ip2md` command to figure out what method is located at the `0x00007f59b40900cc` address
88
+
4. The top frame `0x00007f59b40900cc` is repeated several times. Use the [SOS](sos-debugging-extension.md) `ip2md` command to figure out what managed method is located at the `0x00007f59b40900cc` address
86
89
87
90
````
88
91
(lldb) ip2md 0x00007f59b40900cc
@@ -103,7 +106,19 @@ Often just seeing this callstack is enough to identify the problematic repeating
103
106
Source file: /temp/Program.cs @ 9
104
107
````
105
108
106
-
5. Go look at the indicated method temp.Program.Main(System.String[]) and source "/temp/Program.cs @ 9" to see if you can figure out what you did wrong. If it still wasn't clear you could use further debugger commands to inspect the current state of the process or add logging in that area of the code.
109
+
5. Go look at the indicated method temp.Program.Main(System.String[]) and source "/temp/Program.cs @ 9" to see if you can figure out what the code is doing wrong. If additional information is needed, you can use further debugger or [SOS](sos-debugging-extension.md) commands to inspect the process.
110
+
111
+
### [Windows](#tab/windows)
112
+
113
+
Running the application under the debugger in [Visual Studio](/visualstudio/debugger/what-is-debugging) will show a StackOverflowException in the exception helper dialog and highlight the line of code responsible for making the final call that overflows the stack.
114
+
115
+
[Visual Studio StackOverflowException dialog](media/visual_studio_stackoverflow_exception.png)
116
+
117
+
The callstack debugger window also shows the stack.
118
+
119
+
[Visual Studio StackOverflow callstack](media/visual_studio_stackoverflow_callstack.png)
120
+
121
+
You can use all the normal Visual Studio debugger features to investigate each frame on the callstack, its source code, and the value of local variables.
0 commit comments