Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug C# without breakpoints in Visual Studio?

I'm having trouble to find the statement that causes a given side-effect. I put a breakpoint in every class member and I still can't make the execution pause on the culprit line.

  • Is there a debugger option that makes the execution to pause at every line regardless of breakpoints?

or

  • How to make every line a breakpoint without the effort of marking them manually?
like image 317
Jader Dias Avatar asked Dec 08 '10 15:12

Jader Dias


2 Answers

You can pause execution, and then start tracing line by line (e.g. by pressing F10). This would give you the exact same effect of breaking at every line.

Edit: You won't have to put a breakpoint in each method is you use "trace into" (by pressing F11 in default settings). Then the debugger will stop in the first line of the method being called.

If you're having trouble debugging it, maybe before going for breakpoints some more static analysis is required... Can you describe the side effect you are trying to hunt down? Maybe then people can offer suggestions on how to find it or at least narrow the search.

Edit 2: I don't think you will find the side effect you described through a breakpoint. The verification of signed code is done by the CLR when you load a signed assembly. It has to access the network in order to update revocation lists.

To workaround this problem you can disable CRL checking. Here's some info on how to do it: http://technet.microsoft.com/en-us/library/cc738754(WS.10).aspx

Of course, you should be aware of the security implications (what if the certificate for the code you are running really was revoked?)

like image 85
Ran Avatar answered Sep 20 '22 11:09

Ran


Put a breakpoint on the first line of your code that gets executed (e.g. the first line of your main function, if you're a console application). Then just use the single-step commands (F10 and F11, by default) to walk through the execution.

like image 25
Damien_The_Unbeliever Avatar answered Sep 20 '22 11:09

Damien_The_Unbeliever