WriteableBitmap exception when having multiple threads
===

I create about 10 threads doing the same work - downloading image from the Internet. After the download is completed it will raise this callback function:

    private void DownloadImageWrapper(IRestResponse response, params object[] args)
    {
        byte[] imageData = response.RawBytes;
        using (Stream ms = new MemoryStream(imageData))
        {
            WriteableBitmap wbImg = PictureDecoder.DecodeJpeg(ms);

            callback.DynamicInvoke(wbImg, file);
        };
    }

The exception is thrown in line with WriteableBitmap. I read that lock will help with this, but couldn't find anything about "what" I should lock there. Anyone would help?