[CSHARP-496] Casting BsonObjectId to string through System.Convert.ToString fails Created: 15/Jun/12 Updated: 02/Apr/15 Resolved: 19/Jun/12 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.4.2 |
| Fix Version/s: | 1.5 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Hans Torm | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows |
||
| Attachments: |
|
| Description |
|
Using System.Convert.ToString to handle casts of BsonObjectId to string does not work. When used together with a class that uses BsonObjectId this creates an InvalidCastExpection even though the class supports direct Object.ToString() conversion. The problem is that MongoDB.Bson.BsonValue.System.IConvertible.ToString(IFormatProvider provider) does NOT support casting of BsonObjectId. I have specificly encountered the issue when using ASP MVC's ListBox HtmlHelper together with an object using BsonObjectId as id. I have attached an example error message. |