dynamically compiled c# code - is it debuggable in 2.0?

  • Thread starter Thread starter Benny Raymond
  • Start date Start date
Benny,

This would depend on where you are getting the code from. The IDE would
have to be able to find the code file somehow. If you were getting it from
a database or something of that nature, I don't think that it would work
(very little would, actually).

Hope this helps.
 
Does anyone know off hand if dynamically compiled C# is debuggable in
.net 2.0?
You can allways debug a dissassembly of the code, but when it comes to debugger
symbols it depends. If you generate the code with the CodeDOM or use a string
based template, and compile with an ICompiler implementation, you can set
the IncludeDebugInformation on the CompilerParameters argument passed to
the ICodeCompiler's compile methods to generate a PDB-file.
If you're using Reflection.Emit, you're generating IL code on the fly, and
hence you haven't got any source code to generate debugging symbols for.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 
Does anyone know off hand if dynamically compiled C# is debuggable in
.net 2.0?

With Visual Studio 2002/2003, you could debug a dynamically compiled
C# file within the IDE as long as you wrote the DLL & PDB data to
physical files, like so:

CompilerParameters param = new CompilerParameters();
param.GenerateInMemory = false;
param.IncludeDebugInformation = true;
param.OutputAssembly = "C:\Temp\blah.dll";

I haven't tried yet if Visual Studio 2005 can debug code that was
dynamically compiled in-memory.
 
Back
Top