I had a problem with refreshing file list after deleting a file. When I gave command to delete file, the exception was thrown because the refresh method tried to access a fi
I always used this:
System.GC.Collect(); System.GC.WaitForPendingFinalizers();
See here and here