Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

Corrupt Memory

Last post 14 May 2008, 7:14 AM by Glenn. 9 replies.
Sort Posts: Previous Next
  •  01 Apr 2008, 9:50 AM 13580

    Corrupt Memory

    Hi I have just uninstalled DotTwain 5.0 on my development machine and installed version 6.0. Now I get exception "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." about 10 seconds after completion an acquisition. This also happens when I run the sample AcquisitionDemo application.

     

    Any ideas anyone?

     

    Regards,

  •  01 Apr 2008, 10:29 AM 13581 in reply to 13580

    Re: Corrupt Memory

    I have since noticed the following compile warning:

    Warning    3    Referenced assembly 'C:\Program Files\Atalasoft\DotTwain 6.0\Bin\2.0\x86\Atalasoft.DotTwain.dll' targets a different processor than the application.    ICFX

     

    I use a normal HP Laptop (XP SP2), nothing funny there.

     

    Could it be related?

     

    Regards,

  •  01 Apr 2008, 10:48 AM 13582 in reply to 13581

    Re: Corrupt Memory

    StackTrace from AcquisitionDemo App:

     

       at System.Windows.Forms.UnsafeNativeMethods.IntDestroyWindow(HandleRef hWnd)
       at System.Windows.Forms.UnsafeNativeMethods.DestroyWindow(HandleRef hWnd)
       at System.Windows.Forms.NativeWindow.DestroyHandle()
       at System.Windows.Forms.Control.DestroyHandle()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.Windows.Forms.Form.Dispose(Boolean disposing)
       at AcquisitionDemo.Form1.Dispose(Boolean disposing) in C:\Program Files\Atalasoft\DotTwain 6.0\C# Source\VS 05\AcquisitionDemo\MainForm.cs:line 132
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.ApplicationContext.Dispose(Boolean disposing)
       at System.Windows.Forms.Application.ThreadContext.DisposeThreadWindows()

  •  03 Apr 2008, 8:36 AM 13594 in reply to 13582

    Re: Corrupt Memory

    The only real change in DotTwain between 5 and 6 is that we will run the scanning portion of the code in a separate thread when possible. 

    To test if this is causing an issue with your scanner, set the Device.ModalAcquire property to true.  This will disable the threading code.  If this solves the problem, please let me know the name of the scanner driver as listed in the Device.Identity.ProductName.


    Glenn Chittenden Jr.
    Atalasoft Development Team
  •  04 Apr 2008, 9:33 AM 13604 in reply to 13594

    Re: Corrupt Memory

    Hi Glenn

     Yes, that did seem to solve the probem, tanks.

    Device.Identity.ProductName = CanoScan LiDE 25

     Regards,

  •  22 Apr 2008, 8:52 AM 13727 in reply to 13604

    Re: Corrupt Memory

    I have this problem too. And my scanners are also Canons, various models from CanoScan 8400F, DR-2080 and DR-3080CII. Hope you fix this problem soon.
  •  22 Apr 2008, 7:43 PM 13745 in reply to 13727

    Re: Corrupt Memory

    Iczy,

    This isn't a bug in DotTwain, it's an issue with the drivers.  Some drivers simply do not work correctly unless all of the TWAIN requests and UI message pump are running in the same thread.  Setting ModalAcquire to true will disable the threading, but of course locks up your UI until scanning is finished.

    One other workaround would be to run DotTwain entirely in a separate thread, including the parent window. 


    Glenn Chittenden Jr.
    Atalasoft Development Team
  •  22 Apr 2008, 8:09 PM 13746 in reply to 13745

    Re: Corrupt Memory

    Thanks, Glenn.

    But DotTwain 5.0 doesn't have this kind of problem and other .NET twain products either. Even if you stated that it was scanner driver problems but to me, it looked like DotTwain problem. Exception handling in the application won't help either which made this very frustrating.

    I believe error handling in DotTwain should be added to guard against this specific problem and mentioning about it in the documentation would be a great help.

  •  13 May 2008, 10:42 AM 14012 in reply to 13746

    Re: Corrupt Memory

    I too had to use modal acquire with our Ricoh scanners, I ended up re-enabling our in house 5.0 multi-thread code.

    In my opinion it mmay not be Atalasofts 'fault' certain drivers don't work with their new code but given that it is a common problem and there are ways of getting it to always work, a change in how the new threading works would seem appropriate.

     John

  •  14 May 2008, 7:14 AM 14022 in reply to 14012

    Re: Corrupt Memory

    John,

    We have been re-thinking the threading code.  I believe the reason some scanners have issues is because we don't run all of the scanner code in the background thread and it appears a small percentage of scanners get "upset" when you send messages from two different threads, even though that shouldn't matter because TWAIN has it's own ID system.

    I have a good idea of how to resolve this without requiring any code change for our customers, but it probably won't be implemented until the next version.


    Glenn Chittenden Jr.
    Atalasoft Development Team
View as RSS news feed in XML