title: What would cause an application to crash on subsequent start up when managed resources are not disposed?
body: <p>I’m working on an application for a motion tracking device and have discovered some odd behavior that got me curious. The device SDK consists of three DLLs, one of them (the main referenced DLL being used in the application) non-native, and the other two native.</p>
  
  <p>The application has three main actors, the Controller (connection between device and application), Listener (receives tracking information) and an endless stream of Frame objects (the data the Listener receives). All these items are disposable, in turn I believe they use unmanaged resources.</p>
  
  <p>If I do not remove the listener from the controller and then dispose of the controller, the application will crash on subsequent startup. This behavior is sporadic, it might happened at the second, third or later startup.</p>
  
  <p>Although I am making sure I am disposing the objects, I’m still very curious what logic or lack of logic can cause this type of behavior. Because I expect all objects to be disposed when an executable stops running.</p>
  
  <p>Could the device drivers hold onto a reference? And what would be the best way to troubleshoot this?
  So the question is <strong>not</strong> how to dispose, but what would/could cause this, and why- and how can I Sherlock Holmes this.</p>
  
  <p>More information:</p>
  
  <ul>
  <li>No exceptions </li>
  <li>Attaching a debugger doesn't provide more information</li>
  </ul>