Random crashes while retrieving image

Hello,

Sometimes I encounter with exceptions while working with Stemmer.Cvb library:

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at Stemmer.Cvb.DriverLib.RBLockMode(IntPtr, Int32, Int32 ByRef)
at Stemmer.Cvb.Runtime.InteropServices.Processing.GenericInvocation(StandardProcessingFunctionVoid, ReturnCodeTranslation)
at Stemmer.Cvb.Runtime.InteropServices.Processing.StandardProcessing(StandardProcessingFunctionVoid)
at Stemmer.Cvb.Driver.RingBuffer.LockModeFromHandle(IntPtr)
at Stemmer.Cvb.Driver.RingBufferImage.Dispose(Boolean)
at Stemmer.Cvb.Image.Dispose()
at Framework.Hardware.Camera.StemmerCVB.CvbCamera+d__62.MoveNext()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon) at System.Threading.Tasks.TaskCompletionSource1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon)
at Stemmer.Cvb.Async.AcquisitionExtensions+AsyncManager.Worker()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at Stemmer.Cvb.DriverLib.RBLockMode(IntPtr, Int32, Int32 ByRef)
at Stemmer.Cvb.Runtime.InteropServices.Processing.GenericInvocation(StandardProcessingFunctionVoid, ReturnCodeTranslation)
at Stemmer.Cvb.Runtime.InteropServices.Processing.StandardProcessing(StandardProcessingFunctionVoid) at Stemmer.Cvb.Driver.RingBuffer.LockModeFromHandle(IntPtr)
at Stemmer.Cvb.Driver.RingBufferImage.Dispose(Boolean) at Stemmer.Cvb.Image.Dispose()
at Famework.Hardware.Camera.StemmerCVB.CvbCamera+d__62.MoveNext()
at Famework.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef) at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon)
at System.Threading.Tasks.TaskCompletionSource1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon)
at Stemmer.Cvb.Async.AcquisitionExtensions+AsyncManager.Worker()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
at Stemmer.Cvb.DriverLib.RBLockMode(IntPtr, Int32, Int32 ByRef)
at Stemmer.Cvb.Runtime.InteropServices.Processing.GenericInvocation(StandardProcessingFunctionVoid, ReturnCodeTranslation)
at Stemmer.Cvb.Runtime.InteropServices.Processing.StandardProcessing(StandardProcessingFunctionVoid)
at Stemmer.Cvb.Driver.RingBuffer.LockModeFromHandle(IntPtr)
at Stemmer.Cvb.Driver.RingBufferImage.Dispose(Boolean)
at Stemmer.Cvb.Image.Dispose()
at Famework.Hardware.Camera.StemmerCVB.CvbCamera+d__62.MoveNext()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon) at System.Threading.Tasks.TaskCompletionSource1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon)
at Stemmer.Cvb.Async.AcquisitionExtensions+AsyncManager.Worker()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()

async Task StartGrabAsync() 
{
while (IsGrabbing)
 {
  using (var currentImage = await stream.WaitAsync())
  {
   //...
  }
 }
}
//...
public override void StopGrab()
{
 if (!IsGrabbing) return;

 Camera.Stream.Stop();
}

Do you have any ideas why this could happen? This happens relatively rarely, mostly when executing StopGrab method.