I saw many such problems that were resolved, and the problem was mainly due to the fact that the threads were not disposed of properly.
My problem is a little different, follow the code snippet here
foreach (Images item in ListOfImages) { newPath = Path.Combine(newPath, item.ImageName + item.ImageExtension); File.Create(newPath); File.WriteAllBytes(newPath, item.File); }
Where Images is a custom structure and item.File is raw data, byte [].
My problem is that an exception is WriteAllBytes in the line where WriteAllBytes is called. The message says:
The process cannot access the file because it is being used by another process
Again I donโt know how somehow close have to go through the process.
Scriptworks
source share