Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-40

Using a period in the database name causes safe mode to crash.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • SAMUS
    • None
    • .Net Framework 4
      Console Application

    Description

      Using a database name with a period in it works for most operations but causes safe mode to throw an error. If these are not valid database names reject them at connection time so the error is obvious. E.g. this code fails:

      mongo["The.DB"]["TheCollection"].Insert(new Document
      {

      { "ABC", 123 }

      }, true);

      Either turning off safe more or removing the period from the database name cause the program to work correctly. MongoDB logs this to the console:

      connection accepted from 127.0.0.1:46634 #87
      Assertion failure toSend.data util\message.cpp 380
      AssertionException in connThread, closing client connection
      connection accepted from 127.0.0.1:46635 #88

      .Net dumps the following:

      Unhandled Exception: MongoDB.Driver.MongoCommException: Could not read data, communication failure ---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
      at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
      at System.IO.BinaryReader.ReadInt32()
      at MongoDB.Driver.Protocol.ReplyMessage.ReadHeader(BinaryReader reader)
      at MongoDB.Driver.Protocol.ReplyMessage.Read(Stream stream)
      at MongoDB.Driver.Connections.Connection.SendTwoWayMessage(IRequestMessage msg)
      at MongoDB.Driver.Cursor.RetrieveData()
      — End of inner exception stack trace —
      at MongoDB.Driver.Cursor.RetrieveData()
      at MongoDB.Driver.Cursor.<>c__Iterator0.MoveNext()
      at MongoDB.Driver.Collection.FindOne(Document spec)
      at MongoDB.Driver.Database.SendCommandCore(Document cmd)
      at MongoDB.Driver.Database.SendCommandCore(String command)
      at MongoDB.Driver.Collection.CheckError(Boolean safemode)

      Attachments

        Activity

          People

            sam Sam Corder
            barrydahlberg Barry Dahlberg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: