This project has moved. For the latest updates, please go here.

TwainException : Fujitsu fi-5530C2‎

May 20, 2015 at 11:13 AM
Dear All,

I have a problem when acquire process, here is the exception :


TwainException: DG DAT MSG out of expected sequence.
at Saraff.Twain.Twain32._GetImageInfo()
at Saraff.Twain.Twain32._FileTransferPictures()
at Saraff.Twain.Twain32._TwCallbackProcCore(TwMSG msg, Action`1 endAction)
ConditionCode = SeqError; ReturnCode = Failure;


Scanner : Fujitsu fi-5530C2‎
Supported Capabilities : http://workshop.openthinklabs.com/resources/programming-language/csharp/studi-kasus/alisjk-smartscan/fujitsu-fi-5530c2/supported-capabilities

I hope i can find some help in this forum.
Thank you very much ....
Coordinator
May 20, 2015 at 7:59 PM
Hello, wildanm.
You have shown only a part of the call stack. Necessary that you showed full call stack.
Oct 15, 2015 at 5:40 PM
I have a similar issue acquiring the image data.

This is the full stack trace:
AcquireError: DG DAT MSG out of expected sequence.
at Saraff.Twain.Twain32._MemoryTransferPictures(Boolean isMemFile)
at Saraff.Twain.Twain32._TwCallbackProcCore(TwMSG msg, Action`1 endAction)

Scanner: Panasonic KV-S1057C
Specs: http://panasonic.net/pcc/products/scanner/kv-s1057c_1027c/specifications.html
Driver: http://panasonic.net/pcc/support/scanner/s1057c/index.html
Coordinator
Oct 15, 2015 at 7:10 PM
Hello, javamike.
Apparently, the memory transfer mode is not supported by a driver of scanner. Nonetheless, you have shown only a part of the call stack. Necessary that you showed full call stack.
Oct 16, 2015 at 11:46 PM
Hello SARAFF,

I updated to the newest SARAFF.TWAIN.DLL 1.0.17.440 from 1.0.15.427 and still have the same error.

The driver does support memory transfer mode.
INFO - Cap Enumeration[0]:[IXferMech], value[0]
INFO - Cap Enumeration[1]:[IXferMech], value[2]
INFO - Cap Enumeration[2]:[IXferMech], value[1]
INFO - Current Cap object:[IXferMech], value[0], type[System.UInt16]
INFO - Setting Cap object:[IXferMech], value[Memory], type[Saraff.Twain.TwSX]


My current code works correctly for scanners that support TwUnits.Pixels. If the scanner only supports TwUnits.Inches, I get the below error.

10/16/2015 14:37:56.084 - SEVRE - TwainException: source[Saraff.Twain], DG DAT MSG out of expected sequence.
at Saraff.Twain.Twain32._MemoryTransferPictures(Boolean isMemFile)
at Saraff.Twain.Twain32._TwCallbackProcCore(TwMSG msg, Action`1 endAction)
10/16/2015 14:37:56.084 - SEVRE - TwainException: conditionCode[SeqError], returnCode[Failure], targetSite[Void _MemoryTransferPictures(Boolean)]
data[0]
helpLink[]
innerEx[]

INFO - Cap Enumeration[0]:[IUnits], value[0]
INFO - Current Cap object:[IUnits], value[0], type[System.UInt16]
INFO - Setting Cap object:[IUnits], value[Pixels], type[Saraff.Twain.TwUnits]
WARN - Unable to Set Cap Continuing, TwainException: Data parameter out of range.
at Saraff.Twain.Twain32.SetCap(TwCap capability, Object value)
at CNF_DMSTwain.SaraffTwain.SetCapability(TwCap twCap, Object value)



Can you elaborate on "show full call stack"? That is all TwainException produces.
            _twain32.AcquireError += (object sender, Twain32.AcquireErrorEventArgs e) =>
            {
                try
                {
                    TwainException te = e.Exception;
                    LOGGER.Log(LOG_LEVEL_SEVERE, string.Format("\tTwainException: source[{0}], {1}\n{2}", te.Source, te.Message, te.StackTrace));

                    LOGGER.Log(LOG_LEVEL_SEVERE, string.Format("\tTwainException: conditionCode[{0}], returnCode[{4}], targetSite[{5}] \ndata[{1}] \nhelpLink[{2}] \ninnerEx[{3}]", 
                        te.ConditionCode, te.Data.Count, te.HelpLink, te.InnerException, te.ReturnCode,  te.TargetSite));

                    foreach (KeyValuePair<string, int> kv in te.Data)
                        LOGGER.Log(LOG_LEVEL_SEVERE, string.Format("\t te.Data [{0}]", kv));
                }
                catch (Exception ex)
                {
                    LOGGER.Log(LOG_LEVEL_SEVERE, string.Format("\tAcquireError: {0}\n{1}", ex.Message, ex.StackTrace));
                }
            };
There is nothing written to the Twain log file.

When I test with Saraff.Twain.Sample2.x86.exe sample application selecting; Panasonic KV-S1057C KV-S1027C driver, 200dpi, RGB, Memory, I get the same error as above. When I test with Saraff.Twain.Sample1.x86.exe without changing any setting I get the image as expected with no errors.
Coordinator
Oct 17, 2015 at 1:05 PM
Hello, javamike.
A Saraff.Twain.Sample1.x86.exe work in a twain 1.x mode and using only a native transfer mode.
A Saraff.Twain.Sample2.x86.exe work in a twain 2.x mode.
Anyway the problem associated with the scanner driver (a data source).

P.S.
full call stack for twain 2.x mode:
InvalidOperationException: debug exception.
   в Saraff.Twain.Twain32._MemoryTransferPictures(Boolean isMemFile) в \Saraff.Twain\Twain32.cs:строка 1146
   в Saraff.Twain.Twain32._TwCallbackProcCore(TwMSG msg, Action`1 endAction) в \Saraff.Twain\Twain32.cs:строка 1280
   в Saraff.Twain.Twain32._TwCallbackProc(TwIdentity appId, TwIdentity srcId, TwDG dg, TwDAT dat, TwMSG msg, IntPtr data) в \Saraff.Twain\Twain32.cs:строка 1220
line: Saraff.Twain.Twain32._TwCallbackProc(TwIdentity appId, TwIdentity srcId, TwDG dg, TwDAT dat, TwMSG msg, IntPtr data)
missing in your a stack trace

full call stack for twain 1.x mode:
InvalidOperationException: debug exception.
   в Saraff.Twain.Twain32._MemoryTransferPictures(Boolean isMemFile) в \Saraff.Twain\Twain32.cs:строка 1146
   в Saraff.Twain.Twain32._TwCallbackProcCore(TwMSG msg, Action`1 endAction) в \Saraff.Twain\Twain32.cs:строка 1278
   в Saraff.Twain.Twain32._MessageFilter.PreFilterMessage(Message& m) в \Saraff.Twain\Twain32.cs:строка 2207
line: Saraff.Twain.Twain32._MessageFilter.PreFilterMessage(Message& m)
missing in your a stack trace