[CSHARP-31] Oid == operator overload: null comparison problem Created: 30/Mar/10 Updated: 01/Apr/10 Resolved: 01/Apr/10 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Antony Dzeryn | Assignee: | Sam Corder |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
The == overload in the Oid class is incorrect. In the case that one of the Oids in a comparison is null, an exception is thrown. The overload does not take into account the possibility that either reference is null. This is what the overload should look like: public static bool operator ==(Oid a, Oid b){ // Return true if both are same instance or both are null // Return false if only one instance is null return a.Equals(b); This is taken from the following MS site: http://msdn.microsoft.com/en-us/library/ms173147%28VS.80%29.aspx |
| Comments |
| Comment by Sam Corder [ 01/Apr/10 ] |
|
I was only able to produce an exception when comparing two null oids together. Will be released in 0.82.2 |
| Comment by David O'Hara [ 01/Apr/10 ] |
|
I noticed this got moved to "In Progress", it's implemented on my fork so you can feel free to pull it. http://github.com/davidmohara/mongodb-csharp/ |