HttpException thrown when trying to re-open storage after connection lost/re-established in MonoTouch

Apr 23, 2012 at 11:26 AM
Edited Apr 23, 2012 at 11:26 AM

I have been testing out how the SharpBox lib handles different scenarios for loss of connection and I have hit a brick wall with one scenario in particular. It's not a major problem, however, I can't seem to see why it behaves as it does.

Basically what I am doing is connecting to the storage via

Storage.Open

Then I make a call to:

Storage.DownloadFile

Mid-way through the download I disable my connection (not from the device but from the access point). As expected (as I have changed the timeout periods) I get a timeout exception on attempting to read from the request stream. On this exception I am closing the storage as things like the internal Session etc may become invalid. I then re-establish the connection (to the same access point) and attempt to re-open the Storage, however, any initial call to Dropbox after this seems to throw a SharpBoxException which has an internal HttpException status code 400 (Bad Request). The Sharpbox error is ErrorCouldNotRetrieveDirectoryList.

Any subsequent calls after this are successful. Any ideas why this may be happening?