dbruning
dbruning

Reputation: 5134

Why can't Windbg's SOS extension give me Syncblock data?

I'm using the Windbg GUI to try to troubleshoot an error in a WPF application, which is self-contained with dotnet SDK 8.0.108

If I run "!syncblk", I get this error message:

Error requesting SyncBlk data

Can anyone help me troubleshoot this error message? Why can't it get the syncblk data?

As requested, I've created a minimum reproducible example here

Steps to reproduce:

I'll be interested to hear if anyone else can verify this same repro, or if it's specific to my machine somehow.

I'm using WinDbg 1.2407.24003.0, with the default SOS extension.

Upvotes: 1

Views: 54

Answers (1)

Thomas Weller
Thomas Weller

Reputation: 59513

You are creating the crash dump yourself using DiagnosticsClient.

In your code you have

var dumpType = DumpType.Normal;
// var dumpType = DumpType.WithHeap;

SyncBlocks are stored along with the objects on the heap. Besides the object data, there's also the method table (MT) in front of the object and the syncblock in front of the method table. As explained in a MS article.

In order to analyze sync blocks, you need the heap, because the information is only there. The solution is in the commented line of code: store the crash dump with heap information.

Why DumpType.WithHeap fails with HRESULT 0x80004005 (E_FAIL) - I have no idea. I switched to DumpType.Full and could successfully run !syncblk:

0:000> !syncblk
Index         SyncBlock MonitorHeld Recursion Owning Thread Info          SyncBlock Owner
-----------------------------
Total           80
CCW             5
RCW             10
ComClassFactory 0
Free            0

Upvotes: 1

Related Questions