title: Determine reason of System.AccessViolationException
body: <p>We are having nondeterministic System.AccessViolationException thrown from native code. It's hard to reproduce it, but sometimes it happens. I'm not sure if I can "just debug it" since the time needed for access violation is about 2 hours and there is no guarantees that access violation will happen.</p>
  
  <p>The native library is used by managed wrappers. It's used from java through JNI and it's used from .NET through IKVM'ed JNI. The problem was only reproduced during from IKVM'ed code, but the data sets is different and there is no way to test java application with data used by IKVM'ed application.</p>
  
  <p>I have sources for everything, but (if possible) I want to avoid making large number of changes.</p>
  
  <p>I believe native call stack will provide enough information about reason of this access violation.</p>
  
  <p>Is there any effective ways of determining the reason of this access violation?</p>
  
  <p>I think the ideal solution for me is some changes in code or process environment, so it will crash with memory dump in case of this access violation, so I can make that changes and just wait.</p>