Tuesday, November 15, 2011

debug CodeDom generated code

I wanted to be able to break into generated code.  The following settings create the pdb and the *.vb files needed.

Dim cpd As New VBCodeProvider()
Dim cp As New Compiler.CompilerParameters
cp.ReferencedAssemblies.Add(
"System.dll")
cp.ReferencedAssemblies.Add(
"System.Drawing.dll")
cp.ReferencedAssemblies.Add(
"System.Windows.Forms.dll")
...etc...
cp.GenerateExecutable = False

cp.IncludeDebugInformation = True
cp.CompilerOptions = "/debug:pdbonly"
cp.TempFiles.KeepFiles = True

The last three line made the difference (Tested with vs2005 debugger.)

No comments:

Post a Comment