BanksySan
BanksySan

Reputation: 28500

JIT Debugger only options are new instance of Visual Studio

I'm trying to debug the seed method of an EF migration.

I've added a Debugger.Launch() statement. When it's run I get the message box to attach:

enter image description here

But there's no option to use the existing instance of Visual Studio.

Upvotes: 4

Views: 425

Answers (2)

Ryan Knuth
Ryan Knuth

Reputation: 21

This happens to me quite frequently. I use very large Visual Studio solutions that sometimes hang or have other weird behavior. For instance, if I click the "x" the UI goes away, but there's still a "devenv.exe" from that solution left running.

Usually, killing all devenv.exe and restart will work. I believe what happens here is that the JIT debugger window (or it's caller) has a timeout for finding VS processes. If one of your VS processes has hung or is otherwise unresponsive, the timeout occurs and it bails out. I always notice that the JIT window takes a little longer to popup than normal when this problems manifests. The extra time length is almost always the same. That makes me feel fairly confident in my diagnosis.

Thus, I would recommend looking for any stray devenv.exe processes and forcefully killing them. Also, look to see if any of your VS windows have popups that might block responsiveness. As a last resort, shut all devenv processes down and restart one. That always works for me.

Upvotes: 2

BanksySan
BanksySan

Reputation: 28500

I think I know what it is. The code I'm trying to debug is EF migration code. I guess, as this is run via the PowerShell context, it is running in the context of devenv.exe and so can't be debugger via it.

Upvotes: 0

Related Questions