Breaking on a deadlock between multiple startup projects in Visual Studio

Raheel Khan

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:

  • How could I choose which project to break out of multiple start up projects?
  • If a 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?
Andyalmq

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.

edited at
0

Comments

0 comments
Login to comment

Related

Set Multiple Startup Projects in Visual Studio for Mac?

Unable to run multiple startup projects in Visual Studio 2015

More Visual Differentiation between multiple startup debug processes in Visual studio?

Filter and Sort Projects in Visual Studio 2019 For Better Management Of Multiple Startup Projects

Sharing a folder of contents between multiple projects (Visual Studio)

Share a git repository between multiple Visual Studio Team Services Projects

Handling multiple projects in Visual Studio

Multiple Language Projects in Visual Studio

Migration between Visual Studio Team Services projects

Synchronize files between visual studio projects

Is there any way to remember groups of startup projects in Visual Studio?

Visual Studio: debug multiple projects at the same time?

Visual studio solution adding multiple projects

Open multiple Projects/Folders in Visual Studio Code

Connect Multiple Microsoft Visual Studio to same projects

Multiple Projects Visual Studio 2015 npm

Visual Studio Online Dashboard for Multiple Projects

How to switch between target frameworks for .NET Core projects in Visual Studio

How do you share code between projects/solutions in Visual Studio?

Visual Studio recompiles projects that are shared between two solutions for no reason

Adding a reference between typescript projects for unit testing in visual studio

How to share files between php projects in visual studio?

Unresolved External between static library projects in visual studio

Difference between asp.net core projects in Visual Studio

Multiple "Set StartUp Projects" Configurations

Selecting profiles with multiple startup projects

Multiple Startup projects in Solution, in Rider

Visual Studio 2015 Test explorer starts multiple projects on build

Deploy multiple projects to single azure virtual machine from visual studio