1

我有点急于测试 Ayende 刚刚上线的新官方 RavenDB 版本,在我的项目中更新它(链接到 Github)后,我被这个异常措手不及(抱歉,长堆栈跟踪)。有谁知道可能是什么原因造成的?

从“System.Net.IPAddress”上的“ScopeId”获取值时出错。

在 Raven.Imports.Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target) 在 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\DynamicValueProvider.cs:Raven 的第 108 行.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) 在 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft .Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter 编写器,对象值,JsonContract valueContract,JsonProperty 成员,JsonContainerContract containerContract,的第 364 行,C:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs 中的 JsonProperty containerProperty):Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer)的第 123 行、对象值、JsonObjectContract 合同、JsonProperty 成员、JsonContainerContract 集合合同、JsonProperty containerProperty) 在 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports 的第 364 行.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) 在 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer,对象值,JsonObjectContract 合同的第 123 行, JsonProperty 成员, JsonContainerContract collectionContract, JsonProperty containerProperty) 在 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.Serialization 的第 364 行.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) 在 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) 在 c:\Builds\RavenDB 的第 123 行-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue 的第 364 行(JsonWriter writer,Object value,JsonContract valueContract,JsonProperty 成员, JsonContainerContract containerContract, JsonProperty containerProperty) 位于 Raven 的 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 123。Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) 在 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft. Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer,Object value,JsonContract valueContract,JsonProperty member,JsonContainerContract containerContract,JsonProperty containerProperty)的第 364 行在 c:\Builds\RavenDB -Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter 的第 123 行。c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 364在 Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) 在 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src \Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer,对象值,JsonObjectContract 合同的第 123 行,C:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs 中的 JsonProperty 成员、JsonContainerContract collectionContract、JsonProperty containerProperty):Raven.Imports.Newtonsoft.Json.Serialization 的第 364 行。 C:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs 中的 JsonSerializerInternalWriter.SerializeValue(JsonWriter writer,Object 值,JsonContract valueContract,JsonProperty 成员,JsonContainerContract containerContract,JsonProperty containerProperty): c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft 中 Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value) 的第 123 行。Json\Serialization\JsonSerializerInternalWriter.cs:Raven.Imports.Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value) 中的第 61 行:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json \JsonSerializer.cs:Raven.Imports.Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value) 中的第 608 行,位于 c:\Builds\RavenDB-Stable\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\JsonSerializer。 c:\Builds\RavenDB-Stable\Raven.Abstractions\Json\Linq\RavenJToken.cs:Raven.Json.Linq.RavenJToken.FromObjectInternal(Object o, JsonSerializer jsonSerializer) 中的第 580 行:Raven.Json 中的第 80 行。 Linq.RavenJObject.FromObject(Object o, JsonSerializer jsonSerializer) 在 c:\Builds\RavenDB-Stable\Raven.Abstractions\Json\Linq\RavenJObject.cs:Raven.Client 的第 156 行。Document.EntityToJson.GetObjectAsJson(Object entity) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\EntityToJson.cs:第 63 行在 Raven.Client.Document.EntityToJson.ConvertEntityToJson(String key, Object entity, c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\EntityToJson.cs:Raven.Client.Document.InMemoryDocumentSessionOperations.EntityChanged(Object entity, DocumentMetadata documentMetadata) 第 35 行中的 RavenJObject 元数据)在 c:\Builds\ RavenDB-Stable\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:Raven.Client.Document.InMemoryDocumentSessionOperations.b__10 的第 876 行(KeyValuePairConvertEntityToJson(字符串键,对象实体,RavenJObject 元数据)在 c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\EntityToJson.cs:Raven.Client.Document.InMemoryDocumentSessionOperations.EntityChanged 的​​第 35 行(对象实体,DocumentMetadata documentMetadata)在 c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:Raven.Client.Document.InMemoryDocumentSessionOperations.b__10(KeyValuePair)的第 876 行ConvertEntityToJson(字符串键,对象实体,RavenJObject 元数据)在 c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\EntityToJson.cs:Raven.Client.Document.InMemoryDocumentSessionOperations.EntityChanged 的​​第 35 行(对象实体,DocumentMetadata documentMetadata)在 c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:Raven.Client.Document.InMemoryDocumentSessionOperations.b__10(KeyValuePair)的第 876 行Lightweight\Document\InMemoryDocumentSessionOperations.cs:Raven.Client.Document.InMemoryDocumentSessionOperations.b__10(KeyValuePair)的第 876 行Lightweight\Document\InMemoryDocumentSessionOperations.cs:Raven.Client.Document.InMemoryDocumentSessionOperations.b__10(KeyValuePair)的第 876 行2 pair) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:line 739 at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() 在 System.Linq.Buffer 1..ctor(IEnumerable1 源) 在 System.Linq.Enumerable.ToArray[TSource](IEnumerable 1 source) at Raven.Client.Document.InMemoryDocumentSessionOperations.PrepareForEntitiesPuts(SaveChangesData result) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:line 739 at Raven.Client.Document.InMemoryDocumentSessionOperations.PrepareForSaveChanges() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:line 732 at Raven.Client.Document.DocumentSession.SaveChanges() in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\DocumentSession.cs:line 483 at Dem2Server.EntityRepository.StoreToDB(ServerClientEntity entity) in d:\Github\Democracy-2.0\Dem2Server\Dem2Server\EntityRepository.cs:line 160 at Dem2Server.EntityRepository.Add(ServerClientEntity entity) in d:\Github\Democracy-2.0\Dem2Server\Dem2Server\EntityRepository.cs:line 87 at Dem2Model.User.LogInUser(String FBgraphJSON) in d:\Github\Democracy-2.0\Dem2Server\Dem2Server\user.cs:line 171 at Dem2Server.Dem2Hub.ResolveMessage(String message, IWebSocketConnection socket) in d:\Github\Democracy-2.0\Dem2Server\Dem2Server\Dem2Hub.cs:line 74 at Dem2Server.dem2.<>c__DisplayClass8.<>c__DisplayClassa.<Main>b__7(String message) in d:\Github\Democracy-2.0\Dem2Server\Dem2Server\dem2.cs:line 100 at Fleck.WebSocketServer.<>c__DisplayClass8.<OnClientConnect>b__4(String s) at Fleck.Handlers.Hybi13Handler.ProcessFrame(FrameType frameType, Byte[] data, Action1 onMessage, Action onClose, Action 1 onBinary) at Fleck.Handlers.Hybi13Handler.<>c__DisplayClassa.<Create>b__6(FrameType op, Byte[] data) at Fleck.Handlers.Hybi13Handler.ReceiveData(List1 data, ReadState readState, Action 2 processFrame) at Fleck.Handlers.Hybi13Handler.<>c__DisplayClassa.<Create>b__5(List1 d) 在 Fleck.Handlers.ComposableHandler .Receive(IEnumerable 1 data) at Fleck.WebSocketConnection.<>c__DisplayClassb.<Read>b__a(Int32 r) at Fleck.SocketWrapper.<>c__DisplayClasse.<Receive>b__8(Task1 t) 在 System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke() 在 System.Threading.Tasks.Task.Execute()

4

1 回答 1

4

好的,这很简单,从我们需要使用的 RavenDB 2.0 版开始

using Raven.Imports.Newtonsoft;

代替

using Newtonsoft.Json;

Raven's Community中所述, Newtonsoft.Json 在 RavenDB 2.0 中被内部化

于 2013-01-08T00:43:05.977 回答