I have the code below:
proc.Start(); // "proc" opens "foo.txt" and reads it.
proc.Kill();
proc.WaitForExit();
cleanup(); // deletes "foo.txt"
I get an exception telling me "foo.txt" is being used by another process. The only process that would possibly use "foo.txt" is "proc", which I've killed and waited for its exit.
Does Process.Kill not release resources of the killed process? If so, how do I make release the resources held by the killed process so I may clean up.
Thank you.