title: Unhandled Exception During Garbage Collection
body: <p>Language: C#</p>
  
  <p>Runtime: .NET 4 Client</p>
  
  <p>Issue: At ~14 minutes garbage collection occurs (as seen in the Diagnostic Tools) at this point an exception immediately follows with the following information:</p>
  
  <blockquote>
    <p>Exception thrown at 0x163BA480 in Test.exe: 0xC0000005: Access
    violation executing location 0x163BA480.</p>
  </blockquote>
  
  <p>My program references a third party program with the intention to add additional features through addins.</p>
  
  <p>My program is composed of assemblies:</p>
  
  <ol>
  <li>My main program which compiles add-on assemblies from .cs files, displays their names in a WPF window.</li>
  <li>A secondary project which simply handles logging, part of the same solution.</li>
  <li>An additional project which is responsible for loading the addins, part of the same solution.</li>
  <li>Any number of loaded addon assemblies.</li>
  </ol>
  
  <p>All assemblies are loaded into the same Appdomain. Eventually this will be changed so that each assembly is within it's own Appdomain.</p>
  
  <p>In this specific case the addon assembly is a simple class definition with no other executing code/methods i.e.:</p>
  
  <pre><code>using System;
  using Interface;
  namespace TestAddin
  {
      public class TestAddin
      {
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <p>Program runs successfully, loads assemblies, and displays them.</p>
  
  <p>Program then executes the third party program (via a Run() method from the referenced dll)</p>
  
  <p>Program executes successfully for another ~14 minutes, until the previously mentioned exception occurs.</p>
  
  <p>I'm not sure how to debug this, how do I know where the exception occurred? None of the three projects I wrote utilize unmanaged code and the referenced assembly is running in C#, I could find no unmanaged code using dotpeek.</p>
  
  <p>Any help would be greatly appreciated, if any further information is needed I'd be glad to provide it.</p>