<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:38:07 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-893] MongoDB.Bson.Serialization.Serializers.DictionarySerializer do not support empty string as key when CheckElementNames is true</title>
                <link>https://jira.mongodb.org/browse/CSHARP-893</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;We have been running into a pretty bad bug where we noticed some objects were failing to be inserted into mongo. We were getting the following stack trace:&lt;/p&gt;

&lt;p&gt;System.IndexOutOfRangeException&lt;br/&gt;
Index was outside the bounds of the array.&lt;br/&gt;
   at MongoDB.Bson.IO.BsonWriter.CheckElementName(String&#160;name)&lt;br/&gt;
   at MongoDB.Bson.IO.BsonWriter.WriteName(String&#160;name)&lt;br/&gt;
   at MongoDB.Bson.Serialization.Serializers.DictionarySerializer`2.Serialize(BsonWriter&#160;bsonWriter,&#160;Type&#160;nominalType,&#160;Object&#160;value,&#160;IBsonSerializationOptions&#160;options)&lt;br/&gt;
   at MongoDB.Bson.Serialization.BsonClassMapSerializer.SerializeMember(BsonWriter&#160;bsonWriter,&#160;Object&#160;obj,&#160;BsonMemberMap&#160;memberMap)&lt;br/&gt;
   at MongoDB.Bson.Serialization.BsonClassMapSerializer.Serialize(BsonWriter&#160;bsonWriter,&#160;Type&#160;nominalType,&#160;Object&#160;value,&#160;IBsonSerializationOptions&#160;options)&lt;br/&gt;
   at MongoDB.Bson.Serialization.BsonClassMapSerializer.SerializeMember(BsonWriter&#160;bsonWriter,&#160;Object&#160;obj,&#160;BsonMemberMap&#160;memberMap)&lt;br/&gt;
   at MongoDB.Bson.Serialization.BsonClassMapSerializer.Serialize(BsonWriter&#160;bsonWriter,&#160;Type&#160;nominalType,&#160;Object&#160;value,&#160;IBsonSerializationOptions&#160;options)&lt;br/&gt;
   at MongoDB.Driver.Internal.MongoInsertMessage.AddDocument(BsonBuffer&#160;buffer,&#160;Type&#160;nominalType,&#160;Object&#160;document)&lt;br/&gt;
   at MongoDB.Driver.Operations.InsertOperation.Execute(MongoConnection&#160;connection)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection.InsertBatch(Type&#160;nominalType,&#160;IEnumerable&#160;documents,&#160;MongoInsertOptions&#160;options)&lt;br/&gt;
   at MongoDB.Driver.MongoCollection.Insert(Type&#160;nominalType,&#160;Object&#160;document,&#160;MongoInsertOptions&#160;options)&lt;/p&gt;

&lt;p&gt;When researching this issue we came across this: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-624&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-624&lt;/a&gt;, which seemed like it was the issue but we were still experiencing it...&lt;/p&gt;

&lt;p&gt;Upon looking at the code... We tracked this down to the  CheckElementName name is not checking for an empty string (just null), it&apos;s just trying to access the first character (which there are none). The following unit test reproduces this issue in the smallest amount of code possible.&lt;/p&gt;

&lt;p&gt;       &lt;span class=&quot;error&quot;&gt;&amp;#91;Test&amp;#93;&lt;/span&gt;&lt;br/&gt;
        public void TestEmptyDictionaryKeySerialization() {&lt;br/&gt;
            var dictionary = new Dictionary&amp;lt;string, string&amp;gt;() { &lt;/p&gt;
{ &quot;k&quot;, &quot;v&quot; }
&lt;p&gt;, &lt;/p&gt;
{ &quot;&quot;, &quot;emptyKey&quot; }
&lt;p&gt; };&lt;/p&gt;

&lt;p&gt;            using (var buffer = new BsonBuffer()) {&lt;br/&gt;
                using (var bsonWriter = BsonWriter.Create(buffer, new BsonBinaryWriterSettings())) &lt;/p&gt;
{
                    bsonWriter.CheckElementNames = true;
                    var serializer = new Bson.Serialization.Serializers.DictionarySerializer();
                    serializer.Serialize(bsonWriter, dictionary.GetType(), dictionary, serializer.DefaultSerializationOptions);
                }
&lt;p&gt;            }&lt;br/&gt;
        }&lt;/p&gt;</description>
                <environment></environment>
        <key id="106623">CSHARP-893</key>
            <summary>MongoDB.Bson.Serialization.Serializers.DictionarySerializer do not support empty string as key when CheckElementNames is true</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="1" iconUrl="https://jira.mongodb.org/images/icons/priorities/blocker.svg">Blocker - P1</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="bniemyjski">Blake Niemyjski</reporter>
                        <labels>
                            <label>driver</label>
                    </labels>
                <created>Fri, 17 Jan 2014 22:44:04 +0000</created>
                <updated>Sat, 2 Apr 2016 02:41:45 +0000</updated>
                            <resolved>Tue, 28 Jan 2014 01:33:39 +0000</resolved>
                                    <version>1.8.3</version>
                                    <fixVersion>1.9</fixVersion>
                                    <component>Serialization</component>
                                        <votes>1</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="501785" author="craiggwilson" created="Wed, 19 Feb 2014 20:06:51 +0000"  >&lt;p&gt;There are no intended breaking changes.  BTW: We&apos;ve released rc0 as of today...&lt;/p&gt;</comment>
                            <comment id="501771" author="bniemyjski" created="Wed, 19 Feb 2014 19:54:34 +0000"  >&lt;p&gt;Thanks! Are there any breaking changes in 1.9?&lt;/p&gt;</comment>
                            <comment id="498143" author="rstam" created="Wed, 12 Feb 2014 22:17:36 +0000"  >&lt;p&gt;We are planning a beta or RC0 within a week or so. The final version of 1.9 will ship at around the same time as server 2.6.&lt;/p&gt;</comment>
                            <comment id="498130" author="bniemyjski" created="Wed, 12 Feb 2014 22:05:24 +0000"  >&lt;p&gt;Do you have any idea when 1.9 will ship a beta or rc or rtm? We have ~14,500 occurrences for this bug logged in our system as of right now.&lt;/p&gt;</comment>
                            <comment id="488551" author="xgen-internal-githook" created="Tue, 28 Jan 2014 01:33:03 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rstam&apos;, u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-893&quot; title=&quot;MongoDB.Bson.Serialization.Serializers.DictionarySerializer do not support empty string as key when CheckElementNames is true&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-893&quot;&gt;&lt;del&gt;CSHARP-893&lt;/del&gt;&lt;/a&gt;: Code review changes.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/f58e6f679ba14a86b4cd360fb3a323556d818e55&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/f58e6f679ba14a86b4cd360fb3a323556d818e55&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="488550" author="xgen-internal-githook" created="Tue, 28 Jan 2014 01:33:00 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;rstam&apos;, u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-893&quot; title=&quot;MongoDB.Bson.Serialization.Serializers.DictionarySerializer do not support empty string as key when CheckElementNames is true&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-893&quot;&gt;&lt;del&gt;CSHARP-893&lt;/del&gt;&lt;/a&gt;: Fix handling of empty string element names and dictionary key values.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/ea48045a3675242803b754e7bd3ef83ed2330562&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/ea48045a3675242803b754e7bd3ef83ed2330562&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="488419" author="craiggwilson" created="Mon, 27 Jan 2014 21:51:01 +0000"  >&lt;p&gt;Yes.  Beta or RC.  &lt;/p&gt;</comment>
                            <comment id="488375" author="bniemyjski" created="Mon, 27 Jan 2014 20:49:31 +0000"  >&lt;p&gt;Will you guys have a beta build of 1.9 on nuget?&lt;/p&gt;</comment>
                            <comment id="484480" author="bniemyjski" created="Mon, 20 Jan 2014 17:12:38 +0000"  >&lt;p&gt;Thanks for the clarification. We will keep that in mind and try to add checks where possible.&lt;/p&gt;</comment>
                            <comment id="484476" author="rstam" created="Mon, 20 Jan 2014 17:08:44 +0000"  >&lt;p&gt;You shouldn&apos;t have to change your application. If we decide that empty strings are not valid element names the driver will automatically switch to ArrayOfArrays representation if any of the key values is an empty string.&lt;/p&gt;

&lt;p&gt;The only way you would be affected by this is if you index your dictionary elements or write queries against them. In that case you will want to make sure that your application configures the serialization so as to get a consistent representation in the database.&lt;/p&gt;

&lt;p&gt;Note that while the server currently &lt;b&gt;does&lt;/b&gt; allow empty strings as element names, it&apos;s not certain that will always be case in the future. See:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2051&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-2051&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="484472" author="bniemyjski" created="Mon, 20 Jan 2014 16:58:41 +0000"  >&lt;p&gt;We already have gb&apos;s of data in our database. I&apos;m not sure how much of a pita it would be to change the representation now or the tons of places we&apos;d have to change it in. I&apos;d rather just wait/help contrib a fix.&lt;/p&gt;</comment>
                            <comment id="484467" author="rstam" created="Mon, 20 Jan 2014 16:54:32 +0000"  >&lt;p&gt;Dictionaries can be serialized in several ways. This is controlled by the DictionaryRepresentation enum:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    public enum DictionaryRepresentation&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        Dynamic,&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        Document,&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        ArrayOfArrays,&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        ArrayOfDocuments&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;The default representation (probably the one preferred by most users) is Document:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// DictionaryRepresentation Document&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ dictionary: { key1: value1, key2: value2, ... }, ... }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;This representation is only possible when all the keys are strings, and the values of the strings are legal element names. Whether an empty string is a legal element name is somewhat ambiguous, but it&apos;s probably safer to assume that it is not.&lt;/p&gt;

&lt;p&gt;There are two alternative representations:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// DictionaryRepresentation ArrayOfArrays&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ dictionary: [[key1, value1], [key2, value2], ... ], ... }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// DictionaryRepresentation ArrayOfDocuments&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{ dictionary: [{ k: key1, v: value1 }, { k: key2, v: value2 }, ... ], ... }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;The ArrayOfArrays representation was the first representation we used for keys that are not valid element names. But the ArrayOfDocuments representation is sometimes better when you want to index by just the key or just the value.&lt;/p&gt;

&lt;p&gt;The DictionaryRepresentation Dynamic means look at the values of the keys and choose the Document representation if all the keys are valid element names, and choose the ArrayOfArrays representation if not.&lt;/p&gt;

&lt;p&gt;I think there are two issues to address here:&lt;/p&gt;

&lt;p&gt;1. Decide if &quot;&quot; is a legal element name or not, and make sure DictionarySerializer handles keys equal to &quot;&quot; accordingly &lt;br/&gt;
2. CheckElementName should either allow &quot;&quot; as valid or throw a more appropriate exception if not&lt;/p&gt;

&lt;p&gt;Thanks for reporting this.&lt;/p&gt;
</comment>
                            <comment id="484404" author="bniemyjski" created="Mon, 20 Jan 2014 14:50:19 +0000"  >&lt;p&gt;Please let me know if there is anything I can do..&lt;/p&gt;</comment>
                            <comment id="484370" author="craiggwilson" created="Mon, 20 Jan 2014 13:44:40 +0000"  >&lt;p&gt;As you stated, they are legal everywhere even if we don&apos;t recommend them.  My colleague and I need to discuss the right direction here, but we&apos;ll likely fix this as a bug. &lt;/p&gt;</comment>
                            <comment id="484367" author="bniemyjski" created="Mon, 20 Jan 2014 13:32:28 +0000"  >&lt;p&gt;What do you think? The previous issue (&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-624&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-624&lt;/a&gt;) says it&apos;s supported but in this scenario it&apos;s not.  I&apos;d rather have the issues of a dealing with an empty key in a collection then having collection.add(object) fail.&lt;/p&gt;</comment>
                            <comment id="484181" author="bniemyjski" created="Sun, 19 Jan 2014 18:37:28 +0000"  >&lt;p&gt;I think it should play nicely with them. It&apos;s not always easy to detect&lt;br/&gt;
them before inserting and if you have them in your db it&apos;s your issue there&lt;br/&gt;
there.  If .net supports empty keys and mongo does as well so should the&lt;br/&gt;
client&lt;/p&gt;




&lt;p&gt;&amp;#8211; &lt;br/&gt;
Blake Niemyjski&lt;br/&gt;
Software Development Engineer&lt;br/&gt;
CodeSmith Tools, LLC&lt;br/&gt;
&lt;a href=&quot;http://www.codesmithtools.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.codesmithtools.com&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="484023" author="craiggwilson" created="Sat, 18 Jan 2014 01:07:33 +0000"  >&lt;p&gt;Hi Blake,&lt;br/&gt;
  Thanks for the test reproduction.  As a follow-up question, what are you expecting to happen when we encounter an empty string?  Are you expecting it to be valid and should be let through, or should we still throw an exception, just a better exception than IndexOutOfRange.  Off the top of my head, MongoDB doesn&apos;t really play nice with empty keys like this...&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="102841">CSHARP-880</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="13602">SERVER-2051</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10011"><![CDATA[Minor Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrvgwn:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>97582</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>