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