I've realized a LuceneSearcher.cs script based on well tested examples from the internet with Lucene.Net 4.8.0-beta00016 as console application and it works like a charm. Porting this script to an asp.net-application for the web, the command FSDirectory.open(strPath) terminates with a System.TypeInitializationException. After doing a lot of research and variations, I have no idea wheres the problem.
The line of code causing this problem:
Lucene.Net.Store.FSDirectory folder = Lucene.Net.Store.FSDirectory.Open(path);
The result I get from the call of LuceneSearcher.cs:
"Message": "The type initializer for 'Lucene.Net.Diagnostics.Debugging' threw an exception.",
"StackTrace": "at Lucene.Net.Store.BaseDirectory.SetLockFactory(LockFactory lockFactory)
at Lucene.Net.Store.FSDirectory.SetLockFactory(LockFactory lockFactory)
at Lucene.Net.Store.FSDirectory..ctor(DirectoryInfo path, LockFactory lockFactory)
at Lucene.Net.Store.FSDirectory.Open(DirectoryInfo path, LockFactory lockFactory)
at Lucene.Net.Store.FSDirectory.Open(String path)
at LuceneSearcher.Search(String searchText, String[] searchFields) ...",
"ExceptionType": "System.TypeInitializationException"
I've tried a lot of variations and workarounds but have no success. My old LuceneSearcher.cs (v3.0.3) hasn't this problems.
If anyone has solution. Please guide me. I've been stuck for days.