Most of the time when working with visual studio you can debug your applications by simply running your GUI or command-line project in debug mode.
Now sometimes you might be working with projects that are not so easy to debug. For example a windows service, or an installer custom action.
Now one way around this is to create a custom wrapping exe that exercises the same code, but this wont be equivalent to it being run in the field (i.e. from msiexec.exe).
A handy solution to this is to place a call to Debugger.Break() in your code. When this runs windows will ask if you wish to attach a debugger to the running process, which then allows you to debug from this point forward. Great!
Keep in mind you don't want calls to this in your live code! I'd recommend only using it temporarily or ensure it is only included in debug builds by wrapping it in a method attributed with [System.Diagnostics.Conditional("DEBUG")]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment