I am trying to find a content of the default TaskScheduler in a dump of a .NET application. How I can do that?
An application was hung.

I need to make sure that the default scheduler contains a delayed task with a certain delegate.
First, find the method table of the TaskScheduler
0:025> .loadby sos clr
0:025> .symfix c:\debug\symbols
0:025> !name2ee mscorlib.dll System.Threading.Tasks.TaskScheduler
Module: 000007feeea11000
Assembly: mscorlib.dll
Token: 000000000200052e
MethodTable: 000007feef0a8ab0
EEClass: 000007feeebde1a8
Name: System.Threading.Tasks.TaskScheduler
Then, dump the heap to find some objects of that type. Note that I'm using String here, since I don't have an application with a TaskScheduler available.
0:025> !dumpheap -mt <MethodTable>
Now that you have some objects, just dump one of them.
0:025> !do 00000000126ed548
Name: System.String
MethodTable: 000007feef0bda88
EEClass: 000007feeea16a08
Size: 34(0x22) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: 100%
Fields:
MT Field Offset Type VT Attr Value Name
000007feef0c03d0 4000243 8 System.Int32 1 instance 4 m_stringLength
000007feef0bec38 4000244 c System.Char 1 instance 31 m_firstChar
000007feef0bda88 4000248 80 System.String 0 shared static Empty
Notice the shared (static) property Empty for the String. You should get something similar in TaskScheduler for the static property Default.
As you can see, you can see nothing. That's why you need the SOSEX extension and do a !mdt System.Threading.Tasks.TaskScheduler.
0:025> !mdt System.String
System.String
[...]
[s]Empty: string
AppDomain 'Test.exe' (0000000001d73470): 0000000011fc1420[System.String] STRVAL=
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With