views:

179

answers:

2

I have a long running process (40+ min) that I am debugging. I don't want to have to give my workstation my full attention while I'm debugging. I'd like if VS could play a sound if an exception occurs to pull my attention back to my workstation so I can resolve the issue and move on.

Is this possible?

A: 

Well, you could do the righteous thing and add try/catch blocks to your code. Then, if an exception occurs, you could play a sound programmatically in the catch block. This will have the additional benefit of leading to real error handling in your APP.

Bruce
Exceptions will be caught by the debugger first, though, before falling up to the exception handling code. So how will this help him? And who says he doesn't have error handling? Sometimes you might want to debug an exception that shouldn't occur, even if your app handles its occurrence gracefully. Also, playing sounds in an exception catcher hardly seems like good code to me, if a user ever experienced it.
David M
+1  A: 

With all the different events in the Sounds applet of the Control Panel, I think this should be covered.

You just need to figure out which one will get played for the message box that pops up on an exception. Probably "Critical Stop."

As an aside, Visual Studio also adds a "Breakpoint hit" sound event in there, too, as well as events having to do with a build.

Jon Seigel
Doesn't look like there is a setting in the Sounds applet for what I'm looking for. However, the Breakpoint Hit sound works great. I just set a conditional breakpoint and all is good! Thanks!
Freyday