title: How to get stack trace information for logging in production when using the GAC
body: <p>I would like to get stack trace (file name and line number) information for logging exceptions etc. in a production environment. The DLLs are installed in the GAC. Is there any way to do this?</p>
  
  <p><a href="http://www.elumenotion.com/Blog/Lists/Posts/Post.aspx?ID=23" rel="nofollow noreferrer">This article</a> says about putting PDB files in the GAC:</p>
  
  <blockquote>
    <p>You can spot these easily because they will say you need to copy the debug symbols (.pdb file) to the GAC. In and of itself, that will not work.</p>
  </blockquote>
  
  <p>I know this article refers to debugging with VS but I thought it might apply to logging the stacktrace also.</p>
  
  <p>I've followed the instructions for the answer to <a href="https://stackoverflow.com/questions/628565/">this question</a> except for unchecking Optimize code which they said was optional.</p>
  
  <p>I copied the dlls and pdbs into the GAC but I'm still not getting the stack trace information. Here's what I get in the log file for the stack trace:</p>
  
  <pre><code>OnAuthenticate at offset 161 in file:line:column &lt;filename unknown&gt;:0:0
  ValidateUser at offset 427 in file:line:column &lt;filename unknown&gt;:0:0
  LogException at offset 218 in file:line:column &lt;filename unknown&gt;:0:0
  </code></pre>
  
  <p>I'm using NLog.</p>
  
  <p>My NLog layout is:</p>
  
  <pre><code>layout="${date:format=s}|${level}|${callsite}|${identity}|${message}|${stacktrace:format=Raw}"
  </code></pre>
  
  <p>${stacktrace:format=Raw} being the relevant part.</p>