Smuggler exception - : Tried to serialize Json document with empty string/null/whitespace as property name

195 views
Skip to first unread message

Ian Cross

unread,
Oct 8, 2018, 12:05:22 PM10/8/18
to RavenDB - 2nd generation document database
Hi guys,

We are struggling to export some databases and the reason is pretty clear but the fix / source is not as easy. The error in Studio is:

 Raven.Abstractions.Exceptions.SmugglerExportException: Tried to serialize Json document with empty string/null/whitespace as property name. For example KeyValuePair in Dictionary with empty string as key can cause this exception. RavenDB Json serializer does not support this use-case ---> System.IO.InvalidDataException: Tried to serialize Json document with empty string/null/whitespace as property name. For example KeyValuePair in Dictionary with empty string as key can cause this exception. RavenDB Json serializer does not support this use-case
   at Raven.Json.Linq.RavenJTokenWriter.WritePropertyName(String name) in C:\Builds\RavenDB-Stable-3.5\Raven.Abstractions\Json\Linq\RavenJTokenWriter.cs:line 47
   at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter writer, IDictionary values, JsonDictionaryContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in C:\Builds\RavenDB-Stable-3.5\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 1002
   at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in C:\Builds\RavenDB-Stable-3.5\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 429
   at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) in C:\Builds\RavenDB-Stable-3.5\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 103
   at Raven.Imports.Newtonsof

Is there any way of finding out what document(s) may be causing this or which collection? We have > 100 collections and a lot of documents and some hits of where to start looking would be very beneficial.

Cheers,

Ian

Oren Eini (Ayende Rahien)

unread,
Oct 9, 2018, 2:38:45 AM10/9/18
to ravendb
Can you send the full exception stack trace?

--
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Oren Eini
CEO   /   Hibernating Rhinos LTD
Skype:  ayenderahien
Support:  sup...@ravendb.net

Ian Cross

unread,
Oct 9, 2018, 3:28:10 AM10/9/18
to rav...@googlegroups.com

Hi Oren,

 

Sure, this is what I see in Raven Studio:

 

Raven.Abstractions.Exceptions.SmugglerExportException: Tried to serialize Json document with empty string/null/whitespace as property name. For example KeyValuePair in Dictionary with empty string as key can cause this exception. RavenDB Json serializer does not support this use-case ---> System.IO.InvalidDataException: Tried to serialize Json document with empty string/null/whitespace as property name. For example KeyValuePair in Dictionary with empty string as key can cause this exception. RavenDB Json serializer does not support this use-case

   at Raven.Json.Linq.RavenJTokenWriter.WritePropertyName(String name) in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Json\Linq\RavenJTokenWriter.cs:line 52

   at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeDictionary(JsonWriter writer, IDictionary values, JsonDictionaryContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in C:\Builds\RavenDB-3.5-Patch\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 1001

   at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in C:\Builds\RavenDB-3.5-Patch\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 428

   at Raven.Imports.Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) in C:\Builds\RavenDB-3.5-Patch\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 101

   at Raven.Imports.Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) in C:\Builds\RavenDB-3.5-Patch\Imports\Newtonsoft.Json\Src\Newtonsoft.Json\JsonSerializer.cs:line 949

   at Raven.Json.Linq.RavenJToken.FromObjectInternal(Object o, JsonSerializer jsonSerializer) in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Json\Linq\RavenJToken.cs:line 91

   at Raven.Json.Linq.RavenJObject.FromObject(Object o, JsonSerializer jsonSerializer) in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Json\Linq\RavenJObject.cs:line 174

   at Raven.Database.Actions.IndexActions.<>c.<GetIndexes>b__28_1(<>f__AnonymousType2`2 <>h__TransparentIdentifier0) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Actions\IndexActions.cs:line 986

   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()

   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)

   at Raven.Json.Linq.RavenJArray..ctor(IEnumerable`1 content) in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Json\Linq\RavenJArray.cs:line 72

   at Raven.Database.Actions.IndexActions.GetIndexes(Int32 start, Int32 pageSize) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Actions\IndexActions.cs:line 983

   at Raven.Database.Smuggler.SmugglerEmbeddedDatabaseOperations.GetIndexes(Int32 totalCount) in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Smuggler\SmugglerEmbeddedDatabaseOperations.cs:line 48

   at Raven.Abstractions.Smuggler.SmugglerDatabaseApiBase.<ExportIndexes>d__55.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Smuggler\SmugglerDatabaseApiBase.cs:line 1724

   --- End of inner exception stack trace ---

   at Raven.Abstractions.Smuggler.SmugglerDatabaseApiBase.<ExportIndexes>d__55.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Smuggler\SmugglerDatabaseApiBase.cs:line 1745

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Raven.Abstractions.Smuggler.SmugglerDatabaseApiBase.<RunLastExportAsync>d__15.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Smuggler\SmugglerDatabaseApiBase.cs:line 187

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Raven.Abstractions.Smuggler.SmugglerDatabaseApiBase.<ExportData>d__14.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Abstractions\Smuggler\SmugglerDatabaseApiBase.cs:line 139

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at Raven.Database.Server.Controllers.StudioTasksController.<>c__DisplayClass6_0.<<ExportDatabase>b__0>d.MoveNext() in C:\Builds\RavenDB-3.5-Patch\Raven.Database\Server\Controllers\StudioTasksController.cs:line 303

Cheers,

 

Ian

--
You received this message because you are subscribed to a topic in the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/G7NQxWVgXek/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.

Arkadiusz Palinski

unread,
Oct 9, 2018, 4:09:28 AM10/9/18
to rav...@googlegroups.com
Hi,

It throws when exporting index definitions:


Please check if you don't define an empty field in options of any index.

Thanks,
Arek

Ian Cross

unread,
Oct 9, 2018, 10:27:38 AM10/9/18
to rav...@googlegroups.com

Thanks Arkadiusz.

 

This helped a lot because it meant I needed to look at indexes and not documents. I stared at the index definition a lot and wondered why the dynamic fields were causing this. Then eventually realized my stupidity:

 

 

There was no compile error so I didn’t spot the mistake having moved it from using Lamda to a string.

 

Thanks again.

 

Cheers,

 

Ian

Reply all
Reply to author
Forward
0 new messages