Tattakashi123 / t

Automatically exported from code.google.com/p/twaindotnet
0 stars 0 forks source link

Bitmap Renderer error w/ high speed scanner & large number of pages #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Preconditions:
1. Using Fujitsu 6130 scanner

When scanning a large number of pages 20+, the BitmapRenderer.RenderToBitmap() 
method throws a

System.ArgumentException: Parameter is not valid. exception.

This usually occurs when scanning 20+ (duplex mode) or 40+ (simplex mode) 
pages/images.

Please use labels and text to provide additional information.

at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
   at TwainDotNet.Win32.BitmapRenderer.RenderToBitmap() in TwainDotNet\Win32\BitmapRenderer.cs:line 65
   at TwainDotNet.DataSourceManager.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in TwainDotNet\DataSourceManager.cs:line 164
   at TwainDotNet.Wpf.WpfWindowMessageHook.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in TwainDotNet.Wpf\WpfWindowMessageHook.cs:line 29
   at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Original issue reported on code.google.com by jared.r.knipp@gmail.com on 16 Nov 2010 at 8:37

GoogleCodeExporter commented 8 years ago
I think this can be closed, I had made some changes to the project and updated 
to .Net 4.0.   When I did so I added functionality to use the Task class to 
thread out image transfer / converting dib's to tiff's - 1 Task per image.  It 
appears that when using Task w/ a large # of images the delegate that has a 
local reference to the Bitmap and/or IntPtr still hangs around.  When other 
Task threads start executing a memory collision occurs and eventually 
AccessViolationExceptions occur.

Original comment by jared.r.knipp@gmail.com on 20 Nov 2010 at 1:27

GoogleCodeExporter commented 8 years ago
Ok, feel free to re-open the issue if it happens again.

Cheers,

Luke

Original comment by luke.qui...@gmail.com on 20 Nov 2010 at 1:30