Commit 413a76cb authored by Morten Korsgaard's avatar Morten Korsgaard

When adding dynamic properties, fieldName dictionary name not set

parent 9f2cbef7
...@@ -1234,6 +1234,7 @@ internal int AddField(string name) ...@@ -1234,6 +1234,7 @@ internal int AddField(string name)
if (fieldNameLookup.ContainsKey(name)) throw new InvalidOperationException("Field already exists: " + name); if (fieldNameLookup.ContainsKey(name)) throw new InvalidOperationException("Field already exists: " + name);
int oldLen = fieldNames.Length; int oldLen = fieldNames.Length;
Array.Resize(ref fieldNames, oldLen + 1); // yes, this is sub-optimal, but this is not the expected common case Array.Resize(ref fieldNames, oldLen + 1); // yes, this is sub-optimal, but this is not the expected common case
fieldNames[oldLen] = name;
fieldNameLookup[name] = oldLen; fieldNameLookup[name] = oldLen;
return oldLen; return oldLen;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment