Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I finally found a way to workaround it after discovering that my question was a duplicate of <a href="https://stackoverflow.com/questions/875723/how-to-debug-break-in-codedom-compiled-code">How to debug/break in codedom compiled code</a>, which was not obvious for me to find. bbmud gives a very good hint in there to get the debugger working correctly, but doesn't tell how to get into the code. I add a reference to some assembly containing an interface that I want to implement in the scripts:</p> <pre><code>compilerParams.ReferencedAssemblies.Add(typeof(IScript).Assembly.Location); compilerParams.GenerateExecutable = false; // generate the DLL // if you want to debug, this is needed... compilerParams.GenerateInMemory = false; compilerParams.TempFiles = new TempFileCollection(Environment. GetEnvironmentVariable("TEMP"), true); </code></pre> <p>Now when I consider <code>CSharpFriends</code> being an implementation of <code>IPlugin</code>, I can get the interface by casting the <code>obj</code> above:</p> <pre><code>IPlugin script = obj as IPlugin; </code></pre> <p>Then debugging calls to interface methods or properties is as easy as usual! The trick of adding</p> <pre><code> System.Diagnostics.Debugger.Break(); </code></pre> <p>inside the script code also works well but it needs change to the script. As the code inside the application always needs to know what kind of methods are inside the script according to some mechanism (reflexion with attributes or interfaces), using an interface known by both is a very acceptable solution for me.</p> <p>I hope it helps somebody else.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload