[CSHARP-40] Using a period in the database name causes safe mode to crash. Created: 11/May/10  Updated: 19/Oct/16  Resolved: 11/Nov/10

Status: Closed
Project: C# Driver
Component/s: SAMUS
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Barry Dahlberg Assignee: Sam Corder
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

.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)



 Comments   
Comment by Steve Wagner [ 11/Nov/10 ]

Please check if this still exists in our current master and report back here if yes https://github.com/mongodb-csharp/mongodb-csharp/issues.

Comment by Steve Wagner [ 12/May/10 ]

Can you check if it works in for the current development version?

http://github.com/lanwin/mongodb-csharp/tree/typedcollections

Generated at Wed Feb 07 21:35:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.