Is there an easy way to debug code that is compiled during runtime with the CSharpCodeProvider? Like is it possible to easily setup VS to try compiling it or something?
I would hate to have to keep running the program and having it keep compiling the code to find mistakes.
I usually put in a
Debugger.Launch()and then attach a Debugger. Since you didn’t indicate if you’re compiling a separate executable and run it in another Process or just execute the code in your/an isolated AppDomain this is the most flexible approach. Make sure to keep a copy of the Source file around and instruct the CSharpCodeProvide to emit a PDB.