Skip to content

Commit 814487b

Browse files
authored
Stack trace is now generated despite debugger state (#3068)
***NO_CI***
1 parent ea4e0d8 commit 814487b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/CLR/CorLib/corlib_native_System_Exception.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Copyright (c) .NET Foundation and Contributors
33
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
44
// See LICENSE file in the project root for full license information.
@@ -193,8 +193,7 @@ HRESULT Library_corlib_native_System_Exception::SetStackTrace(CLR_RT_HeapBlock &
193193

194194
#if defined(NANOCLR_TRACE_EXCEPTIONS)
195195

196-
if (CLR_EE_DBG_IS(NoStackTraceInExceptions) || CLR_EE_DBG_IS_NOT(Enabled) || CLR_EE_IS(Compaction_Pending) ||
197-
g_CLR_RT_ExecutionEngine.m_fPerformGarbageCollection)
196+
if (CLR_EE_DBG_IS(NoStackTraceInExceptions))
198197
{
199198
// stack trace is DISABLED or...
200199
// no debugger is attached or...
@@ -204,8 +203,11 @@ HRESULT Library_corlib_native_System_Exception::SetStackTrace(CLR_RT_HeapBlock &
204203
(void)dst;
205204
(void)array;
206205

207-
// null the array that would hold the stack trace
208-
obj[FIELD___stackTrace].SetObjectReference(NULL);
206+
// create an empty array for the stack trace
207+
NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(
208+
obj[FIELD___stackTrace],
209+
depth,
210+
g_CLR_RT_WellKnownTypes.m_UInt8));
209211
}
210212
else
211213
{
@@ -243,10 +245,7 @@ HRESULT Library_corlib_native_System_Exception::SetStackTrace(CLR_RT_HeapBlock &
243245
if (!g_CLR_RT_ExecutionEngine.m_fShuttingDown)
244246
#endif
245247
{
246-
if (CLR_EE_DBG_IS_NOT(NoStackTraceInExceptions) && CLR_EE_DBG_IS(Enabled))
247-
{
248-
CLR_RT_DUMP::EXCEPTION(*stack, ref);
249-
}
248+
CLR_RT_DUMP::EXCEPTION(*stack, ref);
250249
}
251250
}
252251

0 commit comments

Comments
 (0)