Debugging dynamically-compiled DLLs

Bucky

Contributor
Joined
Dec 23, 2001
Messages
791
Location
East Coast
I have a class that implements an Interface, and a Windows app
that compiles the code file at runtime and loads it into a class
instance. In this way, I can change the code while the app is
running.

The only downside is that conventional VS.NET debugging
techniques do not work; I can't step through the code, check
variable values, etc. The only method I have to debug at the
moment is a Debug event that I raise whenver I want to return
the value of a variable, but the debugging is very frustrating.

How can I have a dynamically-compiled and loaded DLL and still
be able to debug it "normally"? Or maybe there's an easier method of
debugging?
 
The only way you could get started with this is if you're compiling from a file on disk (you may well be, I don't know) and then loading the assembly dynamically from the compiled version (also on disk). That way, the debugging symbols will be present and point to a valid source file.

That ought to be enough for the debugger you're running under to catch the exception and find source code for it.
 
I see what you mean, but how will VS.NET know when to start
debugging the code? When I set a breakpoint in the code, the
red circle has a little question mark and it says that no symbols
are loaded.

Also, the code and compiled DLLs both on the local HD.
 
Back
Top