Open sganihar opened 9 years ago
I am encountering the same error but in a different manner. I select the scanner and starts the scan (regardless of the scan settings). But if there's no paper in the scanner, it still executes the StartScan and OpenSource method without any exception and shows no error message. If you click on the scan button again, it shows the "Error Opening Data Source" error.
On debugging, I found that the condition in DataSource.cs file settings.AbortWhenNoPaperDetectable
is always coming as false and hence the condition
if (settings.AbortWhenNoPaperDetectable && !PaperDetectable)
throw new FeederEmptyException();
will never throw exception if there's no paper. Moreover, after throwing this error, it fails to close the datasource in the Close method as it tries to Disable the UI first which is returning false as TwainResult and hence it don't pass through the next if condition. I did the following workaround to get it working
if (settings.AbortWhenNoPaperDetectable && !PaperDetectable)
throw new FeederEmptyException();
if (result != TwainResult.Failure)
{
result = Twain32Native.DsmIdentity(
_applicationId,
IntPtr.Zero,
DataGroup.Control,
DataArgumentType.Identity,
Message.CloseDS,
SourceId);
}
@sohaiby you saved my day!
Hi,
I faced an issue in "TestAppWpf", Saying "error opening data source". Following are the steps to reproduce the issue:
If user says cancel in any stage, it should cancel the job and should be ready to re scan.
Please let me know if there is any fix for this.
Thanks and Regards, Saira