Upgraded my app to DotTwain 6.0 and made use of the asynchronous scan capabilities, but frequently and randomly my entire app is freezing up with CPU either at 100% or 50% (on my dual core). Doesn't seem to be any pattern to the lockup. Nor are there any exceptions. Even the DotTwain trace log doesn't report anything unusual (the pattern of calls is consistent... but just ends abrubtly).
Basically here's a summary of what my code is doing:
Main Form starts a Scan Form using ShowDialog(with or without Main Form).
ScanForm then creates Acquisition object (with or without Scan Form in constructor),
hooks up all events acquisition_imageacquire, acquire finished, exceptions, cancel etc...
device.open()
device.transfermethod (file2 mainly)
device.ModalAcquire = false
device.Acquire().
The imageacquire event then calls event handlers to call delegates to update my UI with the scan image (i've removed these calls to the UI but the freezing still happens).
Is there anything important I'm missing to make asynchronous scanning more robust? I have tried scanning 5 batches of 400+ images without a hang. But then I've also had the problem occur without fail batch after batch. Almost seems like luck of the draw. When it's working fine, my dual core CPU usage hovers from 5-25%, but when the problem occurs, it spikes up to 50/100% and stays there. I've even subscribed to thread Application_ThreadException/CurrentDomain_UnhandledException in program.cs with error logging code all with nothing coming up.
Any help/suggestions would be much appreciated.