This project has moved. For the latest updates, please go here.

Threading issue (Stream was not null)

Topics: Developer Forum
May 25, 2009 at 5:06 PM


I'm developing an appliction under c# compact framework and have a little issue with the cf version of FlickrNet.

I have two threads, both instantiating a Flickr object with the same credentials. Now, both objects start downloading pictures using the Download method. What happens most of the time is that the application bails out with an assertion error "Stream was not null--programmer error". I reckon it is thrown in line 53 of LockFile.cs. I also think it is thrown, because of a concurrent access to the file "responseCache.dat".

Is there a way to fix this? Is it even save to have two or more concurrent instantiations of the Flickr object running at the same time?




May 26, 2009 at 10:53 AM

It is quite likely that having two downloads (from one or more instances of the Flickr class) running at the same time might present issues.

I'd recommend just doing the HttpWebRequest work yourself, either that or disabling caching (which seems to be where the issue is).