I have multiple startup projects in my client/server solution. The server is a Console app and the client is a WinForms app. The server/console is launched first in case that matters.
Now there is a deadlock caused by some synchronization client-side code that blocks the server. Thread synchronization is done using simple lock
statements.
When the deadlock occurs, both apps freeze of course and hitting pause/break in VS only breaks the server app, not the client. There are two questions here:
lock
statement is stuck in a deadlock, is there a way to find out which line of code has a current lock on that object?I think your best solution would be to debug your client and server in separate instances of visual studio and setting startup projects accordingly.
As for the second question, I normally set a guid and output on create and release of a lock. to see if this is happening. If it is, I set breakpoints and debug and look at the stack to see where on the calls are coming from. You may be able to output System.Environment.StackTrace to a log to get this information, but I've ever attempted it.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments