[CSHARP-43] Saving empty SortedList<object,int> crashes when getting object Created: 18/Jun/10  Updated: 19/Oct/16  Resolved: 18/Jun/10

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

Type: Bug Priority: Major - P3
Reporter: nisbus Assignee: Steve Wagner
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

VS2010, .NET 4


Attachments: Zip Archive SortedListTest.zip    

 Description   

If you save an object that has a SortedList property and then try to get it from the database you get a cast exception:

Unable to cast object of type 'System.Object[]' to type 'System.Collections.Generic.SortedList`2[MyObject,System.Int32]'.



 Comments   
Comment by Craig Wilson [ 20/Jun/10 ]

I believe integers would work as well.

Comment by nisbus [ 18/Jun/10 ]

This only works if the Key of the SortedList is of type string.
Any other type fails as the key will just contain the name of the class representing the key.

Comment by Steve Wagner [ 18/Jun/10 ]

Fixed in my local branch http://github.com/lanwin/mongodb-csharp/tree/090beta2

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