NullReferenceException when trying to save an exception - Raven.Client.Documents.Session.EntityToBlittable.ShouldSimplifyJsonBasedOnType

36 views
Skip to first unread message

K Johnson

unread,
Apr 18, 2018, 1:08:34 AM4/18/18
to RavenDB - 2nd generation document database
I'm getting a NullReferenceException when trying to save certain types of exceptions. This is being seen on 4.0.3-patch-40033 and 4.0.3-patch-40034

This is the exception that gets thrown when trying to save the previous exception:

"$type": "System.NullReferenceException, mscorlib",
        "ClassName": "System.NullReferenceException",
        "Message": "Object reference not set to an instance of an object.",
        "Data": null,
        "InnerException": null,
        "HelpURL": null,
        "StackTraceString": "   at Raven.Client.Documents.Session.EntityToBlittable.ShouldSimplifyJsonBasedOnType(String typeValue)\r\n   at Raven.Client.Documents.Session.EntityToBlittable.TrySimplifyJson(BlittableJsonReaderObject document)\r\n   at Raven.Client.Documents.Session.EntityToBlittable.ConvertEntityToBlittable(Object entity, DocumentInfo documentInfo)\r\n   at Raven.Client.Documents.Session.InMemoryDocumentSessionOperations.PrepareForEntitiesPuts(SaveChangesData result)\r\n   at Raven.Client.Documents.Session.InMemoryDocumentSessionOperations.PrepareForSaveChanges()\r\n   at Raven.Client.Documents.Session.Operations.BatchOperation.CreateRequest()\r\n   at Raven.Client.Documents.Session.DocumentSession.SaveChanges()\r\n   at [REMOVED]",
        "RemoteStackTraceString": null,
        "RemoteStackIndex": 0,
        "ExceptionMethod": "8\nShouldSimplifyJsonBasedOnType\nRaven.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=37f41c7f99471593\nRaven.Client.Documents.Session.EntityToBlittable\nBoolean ShouldSimplifyJsonBasedOnType(System.String)",
        "HResult": -2147467261,
        "Source": "Raven.Client",
        "WatsonBuckets": null



I have seen this with the following types of exceptions:
  • System.Net.Sockets.SocketException
  • System.Net.CookieException
  • System.Net.HttpListenerException
  • System.Net.ProtocolViolationException
  • System.Net.WebException
  • System.Net.Mail.SmtpException
  • System.Net.Mail.SmtpFailedRecipientException
  • System.Net.Mail.SmtpFailedRecipientsException
  • System.Net.NetworkInformation.NetworkInformationException
  • System.Net.NetworkInformation.PingException
  • System.Net.WebSockets.WebSocketException

Oren Eini (Ayende Rahien)

unread,
Apr 18, 2018, 2:31:38 AM4/18/18
to ravendb
This is a passing test, can you make it fail?

    public class RavenDB_10965 : RavenTestBase
    {
        public class Item
        {
            public Exception E;
        }

        [Fact]
        public void CanSerializeException()
        {
            using (var store = GetDocumentStore())
            {
                Exception e = null;
                try
                {
                    throw new SocketException();
                }
                catch (Exception ex)
                {
                    e = ex;
                }
                using (var s = store.OpenSession())
                {
                    s.Store(new Item
                    {
                        E = e
                    });
                    s.SaveChanges();
                }
            }
        }
    }


Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages