views:

130

answers:

1

On my work computer, debugging in Visual Studio 2008 (SP1) seems to work somewhat different from what I'm used to. I have two problems that might or might not be related.

First problem:

When I'm running a web application in debug mode, and an unhandled exception occurs, I get a Yellow Screen of Death immediately. Normally my code just breaks at the line throwing the exception, allowing me to inspect the state of the program.

For some reason, the only way I can do that on my work PC is to set a breakpoint on the line that threw the exception, and repeat what I did. It's been annoying me for a couple of days now, but I have no idea what could cause this. Any ideas?

Second problem

The WCF webservices used in the site I'm debugging behave a little odd when it comes to debugging as well. Most of the time, setting a breakpoint in the service won't have any effect when it executes that code. At first, I figured I had to attach to the wcfhost process, but that isn't it. When I put a breakpoint on the line where it calls the service, and use F11 to step into the method call, I do end up in the service's code and I can debug all I want.

Why would stepping into work, while breakpoints get ignored? Is there a way to change this behavior?

+2  A: 

For the 1st problem:

  • In Visual Studio go to Debug/Exceptions
  • You should see three columns in the list: "Name" (type of exceptions), "Thrown", "User-handled"
  • In the "User-handled" column you have to activate the checkbox for "Common Language Runtime Exceptions".

Note, if you shouldn't see the "User-handled" column, go to Tools/Options, then click on "Debugging" in the tree and on the list activate "Enable Just My Code (Managed only)". Then the column "User-handled" should be visible in the other dialog and you can activate the according checkbox.

For the 2nd problem: It seems to me as if I have experienced a similar problem. I guess you have to set the breakpoint there, because the WCF service runs on a separate "webserver" (your local VS webserver). Therefore it isn't like a normal method call within your same application and therefore you have to set the breakpoint on the WCF method that gets called. I always did it this way and it worked perfectly for me.

Juri
User-unhandled is checked as far as I know.. unfortunately I don't have access to the machine right now though, so I'll make absolutely sure when I get back into the office. Shame about the WCF debugging :(
Thorarin
As I mentioned, I'm not sure about WCF. For the "user-handled" thing: it happened to me that somehow it got deactivated although it was activated previously. That's why I remember about the setting.
Juri
Just My Code was indeed disabled (can't remember why). I feel like an idiot, but it solved my first problem at least :) It also breaks on unhandled exceptions in WCF services again, which lowers the annoyance level of the second problem somewhat.
Thorarin
:) It is as I mentioned. The same happened to me and I am sure that I didn't disable "Just My Code". It somehow was done automatically and I lost hours till I found the option.
Juri