Load a BitmapSource and save using the same name in WPF -> IOException

后端 未结 5 802
太阳男子
太阳男子 2020-12-21 00:53

When I try to save a BitmapSource that I loaded earlier, a System.IO.IOException is thrown stating another process is accessing that file and the filestream can

5条回答
  •  孤城傲影
    2020-12-21 01:28

    Setting CacheOption to BitmapCacheOption.OnLoad, will not solve your problem. I think there is a bug, but I had the same problem. Finally i loaded my image to a memory stream and disposed the BitmapImage before saving the image to the file.

提交回复
热议问题