C#: Writealltext in loop randomly doesn't write to file : <p>I created an executable which uses an API call to get information and writes it to a file with System.IO.File.WriteAllText . In SSIS i execute the file in a loop with a list of parameters (needs to loop around 3000 times). Everything goes fine, but after a random amount of executes (differs every time i execute although the order of execution remains the same) it fails to create and write to a file. The file doesn't exist. The executable doesn't encounter an error either. So when i want to read from my file in the next step of my loop, it fails. </p>

<p>I have tried to write a try catch block around my code but it still doesn't return any errors. In my loop i always deleted the files after i read them. Now i just let the files stay in the folder so it doesn't exit my loop (as it sometimes creates the file and sometimes it doesn't. That way i can go through my whole loop but it doesn't help not knowing if some files were not updated.</p>

<p>I'm currently out of ideas to try, since to me, the "error" appears completely random and because the program doesn't recognize the fault it's hard to troubleshoot.</p>
