Ported .NET client fixes from 2.x
- #2684
- #2683