Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3862

Answered: Rebex Security: because it is being used by another process

$
0
0

Hello,

The thing is that .NET error messages sometimes happen to be a bit confusing. This exception could be raised by your own code when you use System.IO methods in your code. You can replicate the same error if you try to do something like that:

System.IO.File.Create(@"C:\temp\test.txt");
System.IO.File.Open(@"C:\temp\test.txt", FileMode.Open);

Maybe you created a file or opened a stream which were not closed later.

The solution in this case would be to call .Close() method (or some equivalent) at the end of working with file, like that.

System.IO.File.Create(@"C:\temp\test.txt").Close();

This method will release the file handle and allow you to open it again later.


Viewing all articles
Browse latest Browse all 3862

Trending Articles