R# extension makes VS hang. How to debug?

Hi there,

I've written a R# extension and some part of it apparently kill VS... every once in a while (I can't really narrow it down to a certain action) VS just freezes.
I debugged into the hanging process and found that it hangs below the JetDispatcher, without any of my code to be seen in the call stack:

ntdll.dll!_ZwWaitForMultipleObjects@20()  + 0x15 bytes    
ntdll.dll!_ZwWaitForMultipleObjects@20()  + 0x15 bytes    
kernel32.dll!_WaitForMultipleObjectsExImplementation@20()  + 0x8e bytes    
[Managed to Native Transition]    
JetBrains.Platform.dotCover.Util.dll!JetBrains.Threading.JetDispatcher.Run() + 0x40 bytes    
JetBrains.Platform.dotCover.Util.dll!JetBrains.Threading.JetDispatcher.CreateDispatcherThread.AnonymousMethod__1() + 0x55 bytes    
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) Line 68 + 0x27 bytes    C#
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 581 + 0xd bytes    C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 530 + 0xd bytes    C#
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 519 + 0xe bytes    C#
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() Line 105 + 0x20 bytes    C#
[Native to Managed Transition]    
kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes    
ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes    
ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes   

Without the R# pdb files or sources I can't really drill deeper into what's going on. Is there any chance to get more information about this problem before I start taking out the parts of my extension one by one until I find the one that's causing the problem?
Any help would be greatly appreciated!!!

Best,
Sven

2 comments
Comment actions Permalink

This isn't ReSharper code, it's dotCover. It's a background thread, waiting normally on an event to be signalled to tell it that it needs to do some work. This isn't causing any kind of deadlock or hang.

If VS is hanging, you need to look at what the main thread is doing (it's clearly busy doing something, or the UI would be responsive). You should see that the main thread is waiting for something, most likely with either ReSharper or your plugin code at the top of the call stack. This call stack should give you a good start for where to look for the root cause.

0
Comment actions Permalink

It seems I solved it. The actual deadlock was caused by access to COM objects in an error case, where apparently some locks on these objects still existed from somewhere else... I'm still not entirely shure what's going on, but I removed the COM-accesses from error handling and since then haven't been able to freeze VS again (which was a matter of 1-2 minutes before). Thanks for your help, Matt!

Best,
Sven

0

Please sign in to leave a comment.