i am getting an error message when running a small Auto Updater application. it is based upon MS.NET Compact Framework Sample: Auto Updater and uses the exact same code to download and install onto pocket pc
the auto updater application downloads a cab file and installs it onto the pocket pc - this all works fine on MS pocket PC version 4.20.1081
but when i try to run the auto updater on a pocket pc using MS Win Mobile v5 - the application does download the cab file and then installs it. but then i am presented with this error
Updater.exe
ObjectDisposedException
WaitHandle::CheckResultInternal+0x1c
ManualResetEvent::Reset+0x11
TASK::Wait+0x18
Control::Invoke+0x83
frmUpdate::OnDataRead+0xa9
LazyAsyncResult::InvokeCallback+0x1c
HttpReadStream::doRead+0x40
WorkItem::doWork+0x36
Timer::ring+0x59
i have no idea what this means!! and im even more puzzled as it seems to be an Operating System based error
Any ideas or help is greatly appreciated!
Cheers,
Craig

Error message - ObjectDisposedException - MS Win Mobile v5
Derek Nedelman
Different versions of framework and/or different timing, perhaps.
Solrac Otr
why would this only occur on certain operating systems though
Cheers,
Craig
tcebob
Hi again!
' When cab download is finished, launch it. This will causeim pretty sure the issue is with the LocalFree(pData) function that is being called before ShellExecute completes - but im unsure in what way to check that ShellExecute is complete before attempting to call LocalFree.
any help is greatly appreciated.
Cheers,
Craig
' wceload.exe to initiate installation process
Private Sub AllDone(ByVal sender As Object, ByVal e As System.EventArgs)
Cursor.Current = Cursors.Default
Dim docname As String = GetCurrentDirectory() + "\download.cab"
Dim nSize As Integer = docname.Length * 2 + 2 Dim pData As IntPtr = LocalAlloc(&H40, nSize)Marshal.Copy(Encoding.Unicode.GetBytes(docname), 0, pData, nSize - 2)
Dim see As New SHELLEXECUTEEXsee.cbSize = Convert.ToUInt32(60)
see.dwHotKey = Convert.ToUInt32(0)
see.fMask = Convert.ToUInt32(0)
see.hIcon = IntPtr.Zero
see.hInstApp = IntPtr.Zero
see.hProcess = IntPtr.Zero
see.lpClass = IntPtr.Zero
see.lpDirectory = IntPtr.Zero
see.lpIDList = IntPtr.Zero
see.lpParameters = IntPtr.Zero
see.lpVerb = IntPtr.Zero
see.nShow = 1
see.lpFile = pData
ShellExecute(see)
LocalFree(pData)
Close()
End Sub 'AllDone<DllImport(
"coredll", EntryPoint:="ShellExecuteEx")> _ Shared Function ShellExecute(ByVal ex As SHELLEXECUTEEX) As Integer End Function<DllImport(
"coredll")> _ Shared Sub LocalFree(ByVal ptr As IntPtr) End SubSQLServer2050
That means object you're trying to access has been disposed.
The real world equivalent is when you disposed of your garbage and remembered you threw out important document by mistake. You’re trying to get it back, but it’s too late - garbage has been picked up already…
You need to fix the code to ensure that object (ManualResetEvent in this case) is not disposed while it’s in use.