Hi, I am having a bit of trouble with some files being locked and not released. As far as I can tell it is occouring in the PEReader/LoadUnitFrom/IModule handling. Below is a small code sample that illustrates the issue.
PeReader.DefaultHost host = new PeReader.DefaultHost();
IModule module = host.LoadUnitFrom(exeFile) as IModule;
module = null;
System.Diagnostics.Debug.WriteLine("failed: " + e.ToString());
So we read a module in from a file, then nullify the reference and run the collector (just to be sure everything is disposed of if it can be). Then when we try to delete the file "exeFile" an exception is thrown (permission denied...). On the other
hand if we replace the line: "IModule module = host.LoadUnitFrom(exeFile)
as IModule;" with "IModule module = null" then the file delete succeeds without any exceptions.