[CSHARP-2668] Error "ObjectSerializer does not support BSON type 'Timestamp'" when running against replica set Created: 18/Jul/19 Updated: 08/Feb/23 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | Serialization |
| Affects Version/s: | 2.8.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Daniel Hegener | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Description |
|
When attempting to run a command against a MongoDB replica set it fails with the following stack trace:
This is a major issue for us as it prevents our users from using our application against a replica set. There is a PR already (https://github.com/mongodb/mongo-csharp-driver/pull/312) that contains a tiny fix which could potentially fix the whole problem easily. |
| Comments |
| Comment by Daniel Hegener [ 18/Jul/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Oh no, haha, they did an unfortunate merge on the HangFire.Mongo side which reverted that previously mentioned workaround:
otherwise the workaround would have been in our version of the library... sigh But there's hope nonetheless because a) they merged the fix again later:
and b) they went for a completely different approach in a later version:
Bottom line for me: I'll try out various versions of HangFire.Mongo now and see if one of them works for us without releasing a patch version of our entire solution. Nonetheless, I would suggest and appreciate some investigations on your driver's side, too. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 18/Jul/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
I wonder why they used `dynamic` instead of BsonDocument for the generic type? | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 18/Jul/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
It looks like an isMaster command, which is returning this on a modern replica set:
There are definitely Timestamp values in there that would trip it up if it doesn't know how to deserialize those. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Hegener [ 18/Jul/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
The offending code looks like this
which would make the problem a bit like https://jira.mongodb.org/browse/CSHARP-2271. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Hegener [ 18/Jul/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
It seems as though my idea might work assuming the API stayed about the same so we can swap it out. Somebody worked around that problem on the HangFire side a while ago:
| |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Hegener [ 18/Jul/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
It's actually not us issuing this command. It's the HangFire MongoDB driver (https://github.com/sergeyzwezdin/Hangfire.Mongo) that does it for us. Judging by the stack trace, it would appear like it's something about the MongoDB server time. Mind you, we're using a rather old version 0.2.8 which we will attempt to update through an assembly binding redirect if possible and hope for the issue to disappear. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 18/Jul/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi dnickless, Just so we have some context, can you let us know what command you are running? |