How to add a breakpoint in a managed generic method in windbg (sos)
This is not really a blog post but a micro-post. Someone asked me and since I couldn’t find any post out there calling it out, thought I’d add
If you want to add a breakpoint to a managed method inside windbg using sos extension, the obvious way is to use the extension command !bpmd. However, if the target method is generic or inside a generic type it is slightly tricky, you don’t use <T> but rather `<count of generic types>
So I have a the following inside by foo.exe managed app
namespace Abhinaba
{
public class PriorityThreadPool<t> : IDisposable
{
public bool RunTask(T param, Action<t> action)
{
// cool stuff
}
}
}
To set breakpoint in it I use the following (notice the red highlighted part)
!bpmd ApplicationHost.exe Xap.ApplicationHost.PriorityThreadPool `1.RunTask