Async web service issue (not threading for once...)

  • Thread starter Thread starter Dan Diephouse
  • Start date Start date
D

Dan Diephouse

I am trying to create an Asynchronous web service client. My code is as
follows:

protected void SynchronizeTerminal()
{
SecureMobileDelivery s = new SecureMobileDelivery(Username, Password);

progressControl.InvokeHandler(new
EventHandler(progressControl.SyncingTerminal));
IAsyncResult r = s.BegingetTerminal( new
AsyncCallback(SynchronizeTerminalEnd), s );
}

protected void SynchronizeTerminalEnd(IAsyncResult r)
{
SecureMobileDelivery s = (SecureMobileDelivery)r.AsyncState;
lock(this.terminal)
{
this.terminal = s.EndgetTerminal(r);
}
}

When this code runs I get a System.ArgumentNullException when the
callback trys to run the SynchronizeTerminalEnd method. Why would the
IAsyncResult be null? I'ved looked at the wire and all my messages are
the exact same as when I ran the non async methods.

Thanks,

Dan Diephouse
 
The reason this happened was because I was lock()'ing on a variable that
was null. Doh!
- Dan
 
Back
Top