>>>Hi
>>>
>>>I'm creating a console app to pgp decrypt some files.
>>>
>>>This works but when I try and rename the second (and last) file that is decrypted I get an error file in use message.
>>>
>>>This is the code before I try and rename the file
>>>
>>>
>>>if (fileexists)
>>> {
>>>
>>> PGPDecrypt CES_ConCurDecrypt = new PGPDecrypt(CES_PGPEncryptedFile,
>>> @PGPPrivateKeyFile,
>>> PGPPassword,
>>> @PGPOutPutPath,
>>> @PGPPublicKeyFile);
>>>
>>> FileStream CES_fs = File.Open(CES_PGPEncryptedFile, FileMode.Open);
>>>
>>> CES_ConCurDecrypt.decrypt(CES_fs, @PGPOutPutPath);
>>>
>>> CES_fs.Close();
>>>
>>> }
>>>
>>>
>>>How can I tell what has the output file still open .
>>>
>>>Thanks
>>>
>>>Update
>>>
>>> I solved my problem by add a stream.dispose() in the decryption routine but I'd still like to know in Visual Studio how can I tell what still had the file open ?
>>
>>I think you can only do it thru code (and only find the process responsible) :
http://stackoverflow.com/questions/860656/using-c-how-does-one-figure-out-what-process-locked-a-file>>
>>BTW - best practice is to use "using (stream.......)" which will take care of the dispose() for you (even if there's an exception in the block).
>
>Thanks Viv. At the moment I'm dealing with a pointy headed person who might not let the bouncycastle dll onto his server.
:-{
What are his arguments ?