I am writing multiple files at the same time in c#. I am composing videos of multiple photos and saving them asyncronously in files in the same folder. It can happen that there could be 2-3 savings at the same time. Sometimes after a few savings the program crashes and i get:
The program '...' has exited with code -1073741819 (0xc0000005) 'Access violation'.
if (images % framesPerIO == 0 )
{
MediaComposition clone = composition.Clone();
int videoNumber = images / framesPerIO;
Debug.WriteLine("Reseting clip from" +videoNumber.ToString());
composition = new MediaComposition();
CreateVideo(videoNumber, clone);
}
private async Task CreateVideo(int videoNumber, MediaComposition clone)
{
Debug.WriteLine("Creating xml"+videoNumber.ToString());
StorageFile video = await storageFolder.CreateFileAsync("video" + videoNumber.ToString() + ".xml", CreationCollisionOption.ReplaceExisting);
Debug.WriteLine("xml Created" + videoNumber.ToString());
DateTime now = DateTime.Now;
Debug.WriteLine("SavingAsync XML " + video.DisplayName);
await clips.SaveAsync(video);
Debug.WriteLine("SavedAsync "+video.DisplayName + (DateTime.Now - now).ToString());
}
Now, I have 2 questions:
User contributions licensed under CC BY-SA 3.0