Application crash
<p>My application uses twain dll for scanning documents. There are so many users using my application. But for few users my application hangs and getting the error that my application stopped working. The users reported this issue are using either windows vista or windows 7 version. The memory dump shows “System.Runtime.InteropServices.COMException”. Please see below the stack trace taken from the memory dump.</p>

<p>STACK_TEXT:  </p>

<p>77a6015d ntdll!RtlReportCriticalFailure+0x5b</p>

<p>77a60d68 ntdll!RtlpReportHeapFailure+0x21</p>

<p>77a60e56 ntdll!RtlpLogHeapFailure+0xa1</p>

<p>77a2b0c8 ntdll!RtlSizeHeap+0x69</p>

<p>778212e0 ole32!CRetailMalloc_GetSize+0x21</p>

<p>767f43d9 oleaut32!APP_DATA::FreeCachedMem+0x30</p>

<p>767f3e6c oleaut32!SysFreeString+0x6b</p>

<p>118b1647 VM31bTXP+0x1647</p>

<p>779ee1c4 ntdll!LdrpCallInitRoutine+0x14</p>

<p>779e8dea ntdll!LdrpUnloadDll+0x3d8</p>

<p>779ee8e2 ntdll!LdrUnloadDll+0x46</p>

<p>76aa0979 kernel32!FreeLibrary+0x15</p>

<p>597d6512 twain!CDataSrc::unload+0x22</p>

<p>597d66b9 twain!CDataSrc::SendMessageA+0x81</p>

<p>597d6c1e twain!CDataSrc::identityMsg+0x18</p>

<p>597d6d0d twain!CDataSrc::MessageNoAppCheck+0x47</p>

<p>597d6e14 twain!CDataSrc::IDataSrc+0xd0</p>

<p>597d58f6 twain!CDsm::registerDS+0x1b7</p>

<p>597d5ca3 twain!CDsm::registerDirDSs+0x163</p>

<p>597d5c87 twain!CDsm::registerDirDSs+0x147</p>

<p>597d5dc7 twain!CDsm::findAndRegisterDSs+0x85</p>

<p>597d5ed9 twain!CDsm::findClosestDefaultDS+0xcc</p>

<p>597d634d twain!CDsm::identityMsg+0x17e</p>

<p>597d6404 twain!CDsm::Message+0x91</p>

<p>597d8ec6 twain!DSM_Entry+0x102</p>

<p>0540605c unknown+0x0</p>

<p>119792d3 unknown+0x0</p>

<p>11979255 unknown+0x0</p>

<p>68991eab System_Windows_Forms_ni+0xa51eab</p>

<p>68991eab System_Windows_Forms_ni+0xa51eab</p>

<p>68120317 System_Windows_Forms_ni+0x1e0317</p>

<p>68136d71 System_Windows_Forms_ni+0x1f6d71</p>

<p>68136d1a System_Windows_Forms_ni+0x1f6d1a</p>

<p>68136d1a System_Windows_Forms_ni+0x1f6d1a</p>

<p>68136b74 System_Windows_Forms_ni+0x1f6b74</p>

<p>68140207 System_Windows_Forms_ni+0x200207</p>

<p>Please advise when such exception happens</p>
