Delete a file being used by another process

it may be Garbage Collection issue.

System.GC.Collect(); 
System.GC.WaitForPendingFinalizers(); 
File.Delete(picturePath);

Leave a Comment