[CSHARP-4413] Equality operator of MongoClientSettings is bugged Created: 15/Nov/22 Updated: 28/Oct/23 Resolved: 28/Nov/22 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.19.0 |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Arik Shapiro | Assignee: | Boris Dogadov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
SummaryThe bug is very obvious, the equality does not work because you forgot to implement an equality operator for the WriteConcern class and you are using the equality operator inside the Equals method of the MongoClientSettings. You might be fooled to think that the equality by reference will still work because you have declared all your WriteConcern types static and use only those. you are creating a new instance of WriteConcern out side of the "if". Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).
version 2.18.0
How to ReproduceSteps to reproduce. If possible, please include a Short, Self Contained, Correct (Compilable), Example.
``` var settings1 = MongoClientSettings.FromConnectionString("mongodb+srv://arik:arik123@test.abcd.mongodb.net/?w=majority"); var settings2 = MongoClientSettings.FromConnectionString("mongodb+srv://arik:arik123@test.abcd.mongodb.net/?w=majority"); Console.WriteLine(settings1 == settings2); ``` Result is false.
Additional BackgroundPlease provide any additional background information that may be helpful in diagnosing the bug. |
| Comments |
| Comment by Githook User [ 28/Nov/22 ] |
|
Author: {'name': 'BorisDog', 'email': 'BorisDog@users.noreply.github.com', 'username': 'BorisDog'}Message: |
| Comment by Dmitry Lukyanov (Inactive) [ 15/Nov/22 ] |
|
Hey arik.shapiro@audiocodes.com, thanks for your report, you're right, we will fix it in one of upcoming releases |