CSHARP-797: rebased on master