diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2015-04-06 21:39:48 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2015-04-24 08:36:52 +0300 |
commit | affe15ccffa7a4e67e9373a5f476850df54e49f4 (patch) | |
tree | 1049913795fe1f64f980b9efd7f4b3133c39f8ca /mcs/class/System.Runtime.Serialization | |
parent | d1152054a2829679cc47327af3daafb057b80de2 (diff) |
[S.R.Serialization] fix reader interpreter: "required" check was broken.
Now it should match referencesource behavior.
Diffstat (limited to 'mcs/class/System.Runtime.Serialization')
-rw-r--r-- | mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatReaderGenerator_static.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatReaderGenerator_static.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatReaderGenerator_static.cs index 8ff6ccb1696..ebede5aec67 100644 --- a/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatReaderGenerator_static.cs +++ b/mcs/class/System.Runtime.Serialization/ReferenceSources/XmlFormatReaderGenerator_static.cs @@ -212,8 +212,7 @@ namespace System.Runtime.Serialization int firstRequiredMember; bool[] requiredMembers = GetRequiredMembers (classContract, out firstRequiredMember); bool hasRequiredMembers = (firstRequiredMember < memberCount); - // FIXME: here I converted null as -1 but that may be wrong. - int requiredIndex = hasRequiredMembers ? firstRequiredMember : -1; + int requiredIndex = hasRequiredMembers ? firstRequiredMember : memberCount; while (XmlObjectSerializerReadContext.MoveToNextElement (xmlReader)) { int idx; // used as in "switch (idx)" in the original source. @@ -242,10 +241,10 @@ namespace System.Runtime.Serialization DataMember dataMember = classContract.Members [index]; Type memberType = dataMember.MemberType; if (dataMember.IsRequired) { - int nextRequiredIndex = memberCount + 1; + int nextRequiredIndex = index + 1; for (; nextRequiredIndex < requiredMembers.Length; nextRequiredIndex++) - if (requiredMembers [nextRequiredIndex]) - break; + if (requiredMembers [nextRequiredIndex]) + break; requiredIndex = nextRequiredIndex; } |