Raven DB 批量插入的奇怪异常

Odd exception with Raven DB Bulk Insert

我目前正在试验 RavenDB (3.0) 并尝试使用批量插入功能。然而,尽管批量插入似乎有效,但我在它完成后立即收到异常:

An exception of type 'System.IO.EndOfStreamException' occurred in Raven.Client.Lightweight.dll but was not handled in user code

Additional information: Attempted to read past the end of the stream.

堆栈跟踪是

   at Raven.Client.Connection.ObservableLineStream.<Start>b__1(Task`1 task) in c:\Builds\RavenDB-Stable-3.0\Raven.Client.Lightweight\Connection\ObservableLineStream.cs:line 39
   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

这是我的代码:

 static void Main(string[] args)
 {
     try
     {
        using (var store = new DocumentStore {
                     Url = "http://localhost:8080/", 
                     DefaultDatabase = "Northwind" })
         {
             store.Initialize();
             int total = 10000;
             using (var bulkInsert = store.BulkInsert())
             {
                for (int i = 0; i < total; i++){
                     bulkInsert.Store(new Employee{
                             FirstName = "FirstName #" + i,
                             LastName = "LastName #" + i});
                        }                           
                    }
                }
            }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     finally
     {
         Console.ReadLine();
     }
 }

奇怪的是数据写入数据库(我可以在数据库浏览器中查看它),而且我的异常没有被捕获代码 - 它被标记为未处理,尽管 try/catch.

我很困惑为什么会发生这种情况,更重要的是,我不知道如何预防它。有人有什么想法吗?

该异常来自我们用于批量插入的手表。完成后,我们关闭手表,并抛出异常。 它在内部处理,不会对您的应用程序产生任何影响