[CSHARP-777] System.Threading.ReaderWriterLockSlim Created: 15/Jul/13  Updated: 20/Mar/14  Resolved: 17/Jul/13

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

Type: Bug Priority: Major - P3
Reporter: Pawel Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Unity3D 4.1.5f, Windows 8



 Description   

I try to use method collection.Insert( ) and I have this problem:

NotImplementedException: recursionPolicy != NoRecursion not currently implemented
System.Threading.ReaderWriterLockSlim..ctor (LockRecursionPolicy recursionPolicy)
MongoDB.Bson.Serialization.BsonSerializer..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for MongoDB.Bson.Serialization.BsonSerializer
MongoDB.Driver.Internal.MongoConnection.RunCommandAs[CommandResult] (System.String databaseName, QueryFlags queryFlags, MongoDB.Driver.CommandDocument command, Boolean throwOnError)
MongoDB.Driver.MongoServerInstance.Ping (MongoDB.Driver.Internal.MongoConnection connection)
Rethrow as MongoConnectionException: Unable to connect to server localhost:27017: An exception was thrown by the type initializer for MongoDB.Bson.Serialization.BsonSerializer.
MongoDB.Driver.Internal.DirectMongoServerProxy.Connect (TimeSpan timeout, MongoDB.Driver.ReadPreference readPreference)
MongoDB.Driver.Internal.DirectMongoServerProxy.ChooseServerInstance (MongoDB.Driver.ReadPreference readPreference)
MongoDB.Driver.MongoServer.AcquireConnection (MongoDB.Driver.ReadPreference readPreference)
MongoDB.Driver.MongoCollection.InsertBatch (System.Type nominalType, IEnumerable documents, MongoDB.Driver.MongoInsertOptions options)
MongoDB.Driver.MongoCollection.Insert (System.Type nominalType, System.Object document, MongoDB.Driver.MongoInsertOptions options)
MongoDB.Driver.MongoCollection.Insert (System.Type nominalType, System.Object document)
MongoDB.Driver.MongoCollection.Insert[Task] (AssemblyCSharp.Task document)
MongoDB.Driver.MongoCollection`1[AssemblyCSharp.Task].Insert (AssemblyCSharp.Task document)
AssemblyCSharp.Dal.CreateTask (AssemblyCSharp.Task task) (at Assets/AdminAds/Scripts/Dal.cs:66)
AssemblyCSharp.Dal..ctor () (at Assets/AdminAds/Scripts/Dal.cs:25)
AddNew.ClickAdd () (at Assets/AdminAds/Scripts/AddNew.cs:11)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UIButtonMessage:Send() (at Assets/NGUI/Scripts/Interaction/UIButtonMessage.cs:77)
UIButtonMessage:OnClick() (at Assets/NGUI/Scripts/Interaction/UIButtonMessage.cs:56)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:644)
UICamera:ProcessTouch(Boolean, Boolean) (at Assets/NGUI/Scripts/UI/UICamera.cs:1147)
UICamera:ProcessMouse() (at Assets/NGUI/Scripts/UI/UICamera.cs:906)
UICamera:Update() (at Assets/NGUI/Scripts/UI/UICamera.cs:761)



 Comments   
Comment by Pawel [ 16/Jul/13 ]

Ok, Thanks for your help and interest

Comment by Craig Wilson [ 16/Jul/13 ]

I'm sorry Pawel. I'm not going to be able to help you out here. This seems to be very specific to Unity3D and we have no expertise with this. Might I suggest posting your question to StackOverflow or to the Unity3D support forums?

Comment by Pawel [ 16/Jul/13 ]

I add reference MongoDB.Bson.dll and MongoDB.Driver.dll but MongoDB.Driver.dll have reference to MongoDB.Bson and this reference can't load

Comment by Craig Wilson [ 16/Jul/13 ]

I'm sorry Pawel. I don't know Unity3D. It seems like you need to add a reference to Unity3D to include the MongoDB.Bson.dll. Is that not possible?

Comment by Pawel [ 16/Jul/13 ]

Yes, the server will listen, and the server can connect to when the program is running with VS2010, the problem is Unity3D. Thanks for your interest.

public class Entity
{
public ObjectId Id

{ get; set; }
public string Name { get; set; }

}
void Start () {
var connectionString = "mongodb://localhost";
var client = new MongoClient(connectionString);
var server = client.GetServer();
var database = server.GetDatabase("localList");
var collection = database.GetCollection<Entity>("entities");

var entity = new Entity

{ Name = "Tom" }

;

collection.Insert(entity);
}

I found the problem but I can not fix it. In MongoDB.Driver.dll in references MonoDevelop says Can not Load: MongoDB.Bson!!!!!

Comment by Craig Wilson [ 15/Jul/13 ]

Could you include the code that got you to this point.

It appears as though your server at localhost:27017 isn't listening. Are you sure the server was started. This exception is definitely a little odd. We'll fix that.

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