Remove unreachable from production code MongoDB.Driver.Core.WireProtocol.Messages.Encoders.JsonEncoders namespace

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      The namespace contains 10 classes. Outside of tests, only JsonMessageEncoderFactory is used — and even then only within the namespace itself (CompressedMessageJsonEncoder calls it internally).

       The full picture

       - JsonMessageEncoderFactory is the single entry point — it implements IMessageEncoderFactory and is the only way to reach the concrete encoders. But even this factory is never instantiated in production src/ code outside the namespace.
       - The only non-test, non-namespace reference is in tests/MongoDB.Driver.Tests/Core/Helpers/MessageHelper.cs (TranslateMessagesToBsonDocuments), which is a test helper. However it looks wrong to use the separate encoder to test the actual encoder behavior/output. The helper method should be rewritten to go through binary encoding instead - serialize via BinaryMessageEncoderFactory into a MemoryStream, then deserialize back to BsonDocument.
       - All 10 classes are internal, so they're invisible outside the assembly entirely.

      Bottom line: The entire JsonEncoders namespace is only consumed by tests. It has no production call sites outside its own directory.

            Assignee:
            Unassigned
            Reporter:
            Oleksandr Poliakov
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: