Why was the Lucene.Net pointer throwing a System.IO.IOException unhandled?

Sometimes an exception occurs because the file write.lockcannot be used because it is used by another process, however it is a very simple test application for Lucene.Net, and there is no other process using it, any idea how it could be

The details of the exception are as follows:

System.IO.IOException was unhandled
HResult=-2147024864
Message=The process cannot access the file 
     'c:\temp\luceneidx\write.lock' because it is being used by another process.

Source=mscorlib
StackTrace:
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.File.InternalDelete(String path, Boolean checkHost)
    at System.IO.File.Delete(String path)
    at Lucene.Test.LuceneSearchInternal.get__directory() 
    in C:\Lucene.Test\LuceneSearchResumes.cs:line 35

Relevant exception throwing code

var lockFilePath = Path.Combine(_luceneDir, "write.lock");

if (File.Exists(lockFilePath))
    File.Delete(lockFilePath);   // THROWS exception sometimes

The code mainly consists of this article .

The index is built on the background thread using Task.Factory.StartNew(), and the WPF GUI searches when building the index. There, only one thread writes documents to the index.

Question: What other process uses the Lucene.Net index?

+5
1

, ( ), , . - , , , .

Lucene / , . . , CodeProject , , , .

, /. lock , , .

+2

All Articles