Reputation: 433
I'm getting a very frustrating error when calling Initialize on the EmbeddableDocumentStore class. This is a WPF application that is attempting to start or initialize a RavenDB database at c:\temp\ravenDb.
My code is:
EmbeddableDocumentStore _documentStore = new EmbeddableDocumentStore()
{
DataDirectory = @"C:\temp\RavenDb"
};
using (_documentStore.Initialize())
{
}
Fairly simple. The error occurs at the call to Initialize(). This is the full error:
Microsoft.Isam.Esent.Interop.EsentFileNotFoundException occurred
Message=File not found
Source=Esent.Interop
StackTrace:
at Microsoft.Isam.Esent.Interop.Api.Check(Int32 err) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:line 2736
InnerException:
What's frustrating is when I create a new WPF app and copy in the same code, it works correctly, and is able to initialize and create the base files. Then, when I go back to my main WPF app - the db is now able to initialise (as the files have been created), but any Session.Query call results in the following error:
System.IO.FileNotFoundException occurred
Message=segments.gen
Source=Lucene.Net
StackTrace:
at Lucene.Net.Store.RAMDirectory.OpenInput(String name) in z:\Libs\lucene.net\src\core\Store\RAMDirectory.cs:line 301
InnerException:
Edit: Full Code: It's called from a Background Worker delegate:
private void RefreshGrid()
{
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
if (bw.IsBusy != true)
{
bw.RunWorkerAsync(_domainType);
}
}
void bw_DoWork(object sender, DoWorkEventArgs e)
{
e.Result = EventStoreInstance.Instance.GetAggregateRoots((Type)e.Argument);
}
Which then calls GetAggregateRoots:
//Called in class ctor:
_publisher = publisher;
_documentStore = new EmbeddableDocumentStore()
{
DataDirectory = _dataDir // is "C:\temp\RavenDb"
};
public List<AggregateRootModel> GetAggregateRoots(Type AggregrateRootType)
{
using (_documentStore.Initialize())
{
using (var session = _documentStore.OpenSession())
{
var aggregateRoots = session.Query<AggregateRootModel>()
.Where(p => p.Type == AggregrateRootType.AssemblyQualifiedName).ToList();
return aggregateRoots;
}
}
}
Upvotes: 4
Views: 1175
Reputation: 22956
Those are expected, they are handled internally inside RavenDB. You are seeing them because you are running in the debugger and stopping on any exceptions.
Upvotes: 7