我正在使用 SOS 探索一个带有 WinDbg 的 ASP.NET 进程的小型转储。如果我列出托管线程,我会看到一个正常的线程列表:
0:000> !threads
ThreadCount: 8
UnstartedThread: 0
BackgroundThread: 8
PendingThread: 0
DeadThread: 0
Hosted Runtime: no
PreEmptive Lock
ID OSID ThreadOBJ State GC GC Alloc Context Domain Count APT Exception
XXXX 1 12bc 00000000001441f0 1808220 Disabled 0000000140b10fc8:0000000140b12f20 000000000017f6e0 0 Ukn (Threadpool Worker)
XXXX 2 1334 0000000000152f90 b220 Enabled 0000000000000000:0000000000000000 0000000000121b90 0 Ukn (Finalizer)
XXXX 3 138c 000000000017b100 80a220 Enabled 0000000000000000:0000000000000000 0000000000121b90 0 Ukn (Threadpool Completion Port)
XXXX 4 81c 000000000017eb40 1220 Enabled 0000000000000000:0000000000000000 0000000000121b90 0 Ukn
XXXX 5 5e4 00000000001bccd0 880a220 Enabled 0000000000000000:0000000000000000 0000000000121b90 0 Ukn (Threadpool Completion Port)
XXXX 6 11e4 0000000004bee280 180b220 Disabled 0000000000000000:0000000000000000 0000000000121b90 0 Ukn (Threadpool Worker)
XXXX 7 73c 0000000004c267e0 180b220 Disabled 0000000140b0f158:0000000140b10f20 000000000017f6e0 3 Ukn (Threadpool Worker) System.StackOverflowException (000000007fff0138) (nested exceptions)
XXXX 8 21c 00000000001ad1c0 180b220 Enabled 0000000000000000:0000000000000000 0000000000121b90 0 Ukn (Threadpool Worker)
但是,如果我尝试切换到线程 7(有例外的线程),我会得到:
0:000> ~7s
^ Illegal thread error in '~7s'
尝试切换到任何托管线程时会发生这种情况。我不知道从哪里开始。我真正需要做的是查看该托管线程的堆栈跟踪。