I am using lucence.net which creates a file as a 'lock'. From what i can tell it simply creates a file to write to and if it cant the db is locked. I get the exception below
I call lucence_init() excepting it to happen once. I call it in Application_Start after i set the current working folder and other stuff.
I cant tell when this happens but i do know it only happens when i hit F5 in visual studios. And it (obviously) never happens on the first time. I think it happens when i get an exception, hit stop, fix and try to run the code. I need to use the icon in the system tray to stop the VS webserver and rerun the code (occasionally manually deleting the lock file but now i have visual studios doing it as a post build event. Which is weird, maybe i dont need this part)
Anyways because of this init problem my other code isnt run because of the write exception and i cant change the order and dont want to program around it so how might i solve this problem so its less annoying to debug this webapp?
Lock obtain timed out: NativeFSLock@c:\dev\prj\...\App_Data\LuceneIndex_a\write.lock: System.IO.IOException: The process cannot access the file 'c:\dev\prj\...\App_Data\LuceneIndex_a\write.lock' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Lucene.Net.Store.NativeFSLock.Obtain()