I feel this is a Newtonsoft.Json error and not a NHibernate problem but I
am posting in both support areas of these products so please forgive me if
I am in the posting to the wrong group. I am trying to send an entity that
has been saved to the database using using NHibernate across a SignalR hub
connection. When that object tries to be sent I get the following
exception. I can see that the student object is correctly populated before
it tries to be sent across the wire.
NB. I have removed all DateTimes from the entity mappings and still get
this error so its not to do with date times in my code I don't believe.
Offending line of code: await _hubProxy.Invoke("StudentReceived", student);
Error:
The method or operation is not implemented.
Newtonsoft.Json.JsonSerializationException: Error getting value from
'DefaultValue' on 'NHibernate.Type.DateTimeOffsetType'. --->
System.NotImplementedException: The method or operation is not implemented.
at NHibernate.Type.DateTimeOffsetType.get_DefaultValue()
at GetDefaultValue(Object )
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object
target)
--- End of inner exception stack trace ---
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object
target)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter
writer, Object value, JsonContainerContract contract, JsonProperty member,
JsonProperty property, JsonContract& memberContract, Object& memberValue)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter
writer, Object value, JsonObjectContract contract, JsonProperty member,
JsonContainerContract collectionContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter
writer, Object value, JsonObjectContract contract, JsonProperty member,
JsonContainerContract collectionContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter
writer, IWrappedDictionary values, JsonDictionaryContract contract,
JsonProperty member, JsonContainerContract collectionContract, JsonProperty
containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter
writer, Object value, JsonObjectContract contract, JsonProperty member,
JsonContainerContract collectionContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter
writer, Object value, JsonObjectContract contract, JsonProperty member,
JsonContainerContract collectionContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeISerializable(JsonWriter
writer, ISerializable value, JsonISerializableContract contract,
JsonProperty member, JsonContainerContract collectionContract, JsonProperty
containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter
writer, Object value, JsonObjectContract contract, JsonProperty member,
JsonContainerContract collectionContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter
writer, Object value, JsonObjectContract contract, JsonProperty member,
JsonContainerContract collectionContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeISerializable(JsonWriter
writer, ISerializable value, JsonISerializableContract contract,
JsonProperty member, JsonContainerContract collectionContract, JsonProperty
containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter
writer, Object value, JsonObjectContract contract, JsonProperty member,
JsonContainerContract collectionContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter
writer, Object value, JsonContract valueContract, JsonProperty member,
JsonContainerContract containerContract, JsonProperty containerProperty)
at
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter
jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter
jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter,
Object value)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting
formatting, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value)
I have googled the problem and modified my DTO's and mapping classes to
make sure that lazy loading is not the problem and my objects are not being
NHibernate proxified as the search results suggest. Any help would be
greatly appreciated as I have been stuck on this for a while now. Thanks in
advance.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.