This is an odd one.

With all the guts out I have this:



TextReader tr = new StreamReader("List.txt");
TextWriter tw = new StreamWriter("List2.txt");

//Guts

tw.Close();
tr.Close();
File.Delete("List.txt");
File.Move("List2.txt", "List.txt");

When I run this I get an error of:

An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll

Additional information: The process cannot access the file 'List.txt' because it is being used by another process.

Yet.. When I debug and go through it step by step, it works perfectly.. Odd.. any clues?

Cheers.