File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -185,17 +185,24 @@ public object Deserialize(
185
185
}
186
186
bsonReader . ReadEndDocument ( ) ;
187
187
188
- // check any members left over that we didn't have elements for
188
+ // check any members left over that we didn't have elements for (in blocks of 32 elements at a time)
189
189
for ( var bitArrayIndex = 0 ; bitArrayIndex < memberMapBitArray . Length ; ++ bitArrayIndex )
190
190
{
191
191
var memberMapIndex = bitArrayIndex << 5 ;
192
- var memberMapBlock = ~ memberMapBitArray [ bitArrayIndex ] ;
192
+ var memberMapBlock = ~ memberMapBitArray [ bitArrayIndex ] ; // notice that bits are flipped so 1's are now the missing elements
193
193
194
+ // work through this memberMapBlock of 32 elements
194
195
for ( ; ; )
195
196
{
197
+ // examine missing elements (memberMapBlock is shifted right as we work through the block)
196
198
while ( ( memberMapBlock & 1 ) != 0 )
197
199
{
198
200
var memberMap = allMemberMaps [ memberMapIndex ] ;
201
+ if ( memberMap . IsReadOnly )
202
+ {
203
+ continue ;
204
+ }
205
+
199
206
if ( memberMap . IsRequired )
200
207
{
201
208
var fieldOrProperty = ( memberMap . MemberInfo . MemberType == MemberTypes . Field ) ? "field" : "property" ;
@@ -215,6 +222,7 @@ public object Deserialize(
215
222
break ;
216
223
}
217
224
225
+ // skip ahead to the next missing element
218
226
var leastSignificantBit = FastMemberMapHelper . GetLeastSignificantBit ( memberMapBlock ) ;
219
227
memberMapIndex += leastSignificantBit ;
220
228
memberMapBlock >>= leastSignificantBit ;
You can’t perform that action at this time.
0 commit comments