Skip to content

Commit 0ea072d

Browse files
committed
Fix Sliverlight multidimensional array support does not handle non-zero bound array correctly.
1 parent fd22002 commit 0ea072d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/MsgPack/Serialization/DefaultSerializers/MultidimensionalArraySerializer`1.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,10 @@ this.OwnerContext.ExtTypeCodeMapping[ KnownExtTypeName.MultidimensionalArray ]
200200

201201
#if SILVERLIGHT
202202
// Simulate lowerbounds because Array.Initialize() in Silverlight does not support lowerbounds.
203+
var inflatedLengths = new int[ lengths.Length ];
203204
for ( var i = 0; i < lowerBounds.Length; i++ )
204205
{
205-
lengths[ i ] += lowerBounds[ i ];
206+
inflatedLengths[ i ] = lengths[ i ] + lowerBounds[ i ];
206207
}
207208

208209
#endif // SILVERLIGHT
@@ -229,7 +230,7 @@ this.OwnerContext.ExtTypeCodeMapping[ KnownExtTypeName.MultidimensionalArray ]
229230
lengths,
230231
lowerBounds
231232
#else
232-
lengths
233+
inflatedLengths
233234
#endif // !SILVERLIGHT
234235
);
235236

0 commit comments

Comments
 (0)