Skip to content

.NET Debugging services crash in ASP.NET project that raises exceptions #115668

@gregg-miskelly

Description

@gregg-miskelly

Description

When debugging an ASP.NET project that raises exceptions, the debugger will crash while attempting to unwind the call stack.

The debugger process crashes with the following stack. The issue is that Rsp is 0.

libmscordaccore.so!MemoryRead64(PULONG64 addr) Line 30
libmscordaccore.so!OOPStackUnwinderAMD64::UnwindPrologue(ULONG64 ImageBase, ULONG64 ImageBase@entry, ULONG64 ControlPc, ULONG64 ControlPc@entry, ULONG64 FrameBase, _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry, _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry@entry, PCONTEXT ContextRecord, PCONTEXT ContextRecord@entry, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers@entry, _PIMAGE_RUNTIME_FUNCTION_ENTRY * FinalFunctionEntry) Line 754    
libmscordaccore.so!OOPStackUnwinderAMD64::VirtualUnwind(DWORD HandlerType, DWORD HandlerType@entry, ULONG64 ImageBase, ULONG64 ControlPc, ULONG64 ControlPc@entry, _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry, _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry@entry, PCONTEXT ContextRecord, PCONTEXT ContextRecord@entry, PVOID * HandlerData, PVOID * HandlerData@entry, PULONG64 EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers, PEXCEPTION_ROUTINE * HandlerRoutine) Line 1617   
libmscordaccore.so!OOPStackUnwinderAMD64::Unwind(CONTEXT * pContext) Line 255    
libmscordaccore.so!DacUnwindStackFrame(CONTEXT * pContext, KNONVOLATILE_CONTEXT_POINTERS * pContextPointers) Line 207    
libmscordaccore.so!Thread::VirtualUnwindCallFrame(CONTEXT * pContext, KNONVOLATILE_CONTEXT_POINTERS * pContextPointers, EECodeInfo * pCodeInfo) Line 637    
libmscordaccore.so!EECodeManager::EnsureCallerContextIsValid(PREGDISPLAY pRD, EECodeInfo * pCodeInfo, unsigned int flags) Line 1033   
libmscordaccore.so!StackFrameIterator::ResetRegDisp(StackFrameIterator * this, PREGDISPLAY pRegDisp, bool fIsFirst) Line 1301
libmscordaccore.so!DacDbiInterfaceImpl::SetStackWalkCurrentContext(DacDbiInterfaceImpl * this, IDacDbiInterface::StackWalkHandle pSFIHandle, CorDebugSetContextFlag flag, DT_CONTEXT * pContext) Line 193   
libmscordbi.so!CordbStackWalk::SetContextWorker(CordbStackWalk * this, CordbStackWalk * this@entry, CorDebugSetContextFlag flag, CorDebugSetContextFlag flag@entry, ULONG32 contextSize, ULONG32 contextSize@entry, BYTE * context, BYTE * context@entry) Line 401
libmscordbi.so!CordbStackWalk::SetContext(CordbStackWalk * this, CorDebugSetContextFlag flag, ULONG32 contextSize, BYTE * context) Line 355 
libmscordbi.so!ShimStackWalk::CheckInternalFrame(ICorDebugFrame * pNextStackFrame, ShimStackWalk::StackWalkInfo * pStackWalkInfo, ShimStackWalk::StackWalkInfo * pStackWalkInfo@entry, ICorDebugThread3 * pThread3, ICorDebugStackWalk * pSW) Line 1220
libmscordbi.so!ShimStackWalk::Populate(ShimStackWalk * this, ShimStackWalk * this@entry) Line 265 
libmscordbi.so!ShimStackWalk::ShimStackWalk(ShimStackWalk * this, ShimProcess * pProcess, ICorDebugThread * pThread) Line 33   
libmscordbi.so!ShimProcess::LookupOrCreateShimStackWalk(ShimProcess * this, ICorDebugThread * pThread) Line 1498
libmscordbi.so!CordbThread::FindFrame(CordbThread * this, ICorDebugFrame ** ppFrame, FramePointer fp) Line 1402 
libmscordbi.so!UpdateFrame(ICorDebugThread * pThread, ICorDebugThread * pThread@entry, ICorDebugFrame * pOldFrame) Line 106  
libmscordbi.so!ShimProxyCallback::Exception(ICorDebugAppDomain*, ICorDebugThread*, ICorDebugFrame*, unsigned int, CorDebugExceptionCallbackType, unsigned int)::ExceptionEvent::Dispatch(ManagedEvent::DispatchArgs)(ExceptionEvent * this, ManagedEvent::DispatchArgs args) Line 1184  
libmscordbi.so!CordbProcess::DispatchRCEvent(CordbProcess * this, CordbProcess * this@entry) Line 4763   
libmscordbi.so!CordbRCEventThread::FlushQueuedEvents(CordbRCEventThread * this, CordbRCEventThread * this@entry, CordbProcess * process, CordbProcess * process@entry) Line 10349
libmscordbi.so!CordbRCEventThread::ThreadProc(CordbRCEventThread * this) Line 10607
libmscordbi.so!CordbRCEventThread::ThreadProc(LPVOID parameter) Line 10673  
libmscordaccore.so!CorUnix::CPalThread::ThreadEntry(void * pvParam) Line 1744  
libc.so.6!start_thread(void * arg) Line 447
libc.so.6!clone3() Line 78

Reproduction Steps

  1. Extract the following project: WebApplication6.zip
  2. Run it on Linux -- Docker, WSL, or natively should all work
  3. After the web server is started, hit the '/weatherforecast/` endpoint

Expected behavior

Debugger process should not crash

Actual behavior

Debugger process crashes

Regression?

Regression from .NET 8

Known Workarounds

None known

Configuration

I have seen this in 9.0.4 Linux x64. I didn't try this in any other configuration.

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions