I am trying to store a file in local directory using Windows.Storage but I get an error when I try to store a second image
I am using the Windows.Storage
async void ReceiveDecodedData(byte[] data, int width, int height)
{
StorageFolder storageFolder = KnownFolders.PicturesLibrary;
string filename = "sample" + ".jpg";
StorageFile file = await storageFolder.CreateFileAsync(filename, CreationCollisionOption.OpenIfExists);
await FileIO.WriteBytesAsync(file, data);
}
I want to write the bytes to the image without any error/exceptions.
Exception: "The process cannot access the file because it is being used by another process."