Remote Debugging With Various Build Options
===

I've done some research and testing this morning on how different build options affect the ability to do remote debugging. My research doesn't match with what actually happened during my testing.

First, here are the results:

![enter image description here][1]

**Based on this testing, in order to perform remote debugging, it would appear that Optimize code has to be checked AND Debug Info needs to be set to full. Is this correct?**

The reason I ask is because I've come across this information, from reputable sources:

First, John Robbins say this in his [blog][2]:

>There are four different /debug switches: `/debug`, `/debug+`, `/debug:full`, `/debug:pdb-only`.

>All four switches all do the same thing in that they cause a PDB file to be generated but why are there four switches to do the same thing? The real reason: history. Back in .NET 1.0 there were differences, but in .NET 2.0 there isn't. It looks like .NET 4.0 will follow the same pattern. After double-checking with the CLR Debugging Team, **there is no difference at all**.

**If there is no difference at all, then why did I have to choose Debug info of full in my testing?**

Second, Eric Lippert says this in his [blog][3]:

>The compiler’s “usage” string is not lying when it says:

>/debug[+|-]     Emit debugging information<br>
>/optimize[+|-]  Enable optimizations<br>

>Emitting debug information and optimizing the generated IL are orthogonal; they have no effect on each other at all (*).

**If that's true, then why must optimizations be disabled? Is that because the DebuggableAttribute doesn't get set, in the assembly, when Optimize code is checked?**

Eric also says this:

>"...you might want to debug the optimized version without assertions and we’re not going to stop you."

**That's what we'd like to do. How do we accomplish that?**

**Having said all that, my two questions are:**

1. It would appear that Optimize code has to be checked AND Debug Info needs to be set to full. Is this correct?

2. How do we debug the optimized version without assertions?

  [1]: http://i.stack.imgur.com/8gqDe.png
  [2]: http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/06/19/do-pdb-files-affect-performance.aspx#9864
  [3]: http://blogs.msdn.com/b/ericlippert/archive/2009/06/11/what-does-the-optimize-switch-do.aspx