Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <a href="https://stackoverflow.com/a/875796/109702">answer by @bbmud</a> is correct, though it misses one bug fix. The CSharpCodeGenerator (the class in .NET the compiles C# code to IL) is set to remove pdb files immediately after they are created, UNLESS you add <code>/debug:pdbonly</code> to the CompilerOptions string. However, if you do that, the <code>IncludeDebugInformation</code> flag is ignored and the compiler generates optimised code which is hard to debug. To avoid this you must explicitly tell the Code Generator to keep all files.</p> <p>Here is the complete recipe:</p> <pre><code>parameters.GenerateInMemory = false; //default parameters.TempFiles = new TempFileCollection(Environment.GetEnvironmentVariable("TEMP"), true); parameters.IncludeDebugInformation = true; parameters.TempFiles.KeepFiles = true </code></pre> <p>Here is the culprit part of the code of CSharpCodeGenerator:</p> <pre><code> string fileExtension = "pdb"; if ((options.CompilerOptions != null) &amp;&amp; (CultureInfo.InvariantCulture.CompareInfo.IndexOf(options.CompilerOptions, "/debug:pdbonly", CompareOptions.IgnoreCase) != -1)) { results.TempFiles.AddExtension(fileExtension, true); } else { results.TempFiles.AddExtension(fileExtension); } </code></pre> <p>The <code>TempFiles.AddExtension(fileExtension, true)</code> tells the compile to keep the pdb files. The <em>else</em> option of <code>results.TempFiles.AddExtension(fileExtension);</code> tells it to treat pdb as all temporary files which by default means delete them.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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