[CSHARP-182] Deserializing an object array containing int32s fails with a FileFormatException Created: 21/Mar/11  Updated: 02/Apr/15  Resolved: 21/Mar/11

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 0.11
Fix Version/s: 1.0

Type: Bug Priority: Minor - P4
Reporter: Sridhar Nanjundeswaran Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Exception stack trace is http://pastebin.com/DFAz5eE4
Sample code is
namespace ConsoleApplication
{
class Program
{
public class B
{
[BsonId]
public ObjectId Id

{ get; set; }
public int GetMe { get; set; }


public object[] Items

{ get; set; }


}
static void Main(string[] args)

{ var server = MongoServer.Create("mongodb://localhost/?safe=true"); var database = server["onlinetests"]; var bcoll = database.GetCollection<B>("btest2"); var bee = new B(); bee.GetMe = 1; bee.Items = new object[1]; bee.Items[0] = 123; bcoll.Insert(bee); var bsonValue = new BsonInt32(bee.GetMe); // throws on deserialization var test = bcoll.FindOne(MongoDB.Driver.Builders.Query.EQ("GetMe", bsonValue)); }

}
}



 Comments   
Comment by Robert Stam [ 21/Mar/11 ]

Fixed. Thanks for reporting the issue.

Generated at Wed Feb 07 21:36:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.