Amicable
Amicable

Reputation: 3091

Debugging Backgroundworker

I am using Visual Studio 2010 and I have Debugger.Launch on the first line of my application, which is an update tool. This is the only way I can attach a debugger to the updater fast enough.

(Updates one of two programs, depending on shortcut args, then starts the updated program.)

The problem I am having is that when I attach the debugger to the process, I am unable to step into the debugger. I have tried putting the Debugger.Launch in the backgroundworker thread but this still won't let me step into it.

The thread is still running, as I get an exception if I try to start two (and of course there are breakpoints set).

I don't have this problem when running it from Visual Studio and sending the command args through the debug properties window. How ever it would be much more useful for me to be able to attach the debugger to the installed application. (As currently it works in Visual Studio but not from launching exe)

Does anyone know of a fix or a workaround for this?

Upvotes: 2

Views: 2600

Answers (1)

Guillaume
Guillaume

Reputation: 13138

Call Debugger.Break() instead of Debugger.Launch().

http://msdn.microsoft.com/library/system.diagnostics.debugger.break.aspx

Upvotes: 1

Related Questions