You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
I must be doing something very simply wrong. I have mongodb version 3.0.3 with the latest drivers. I have code like this async Task FooAsync() { var client = new MongoClient("mongodb://localhost:27017"); var database = client.GetDatabase("PSB01"); var collection = database.GetCollection<Book>("book");
await collection.InsertOneAsync(new Book { name = "Get there please" });
// next statements.... }
In my 'main' routine I call FooAsync().Wait();
It never seems to get to the next statement and never returns. BUT it turns out the book really was inserted - I see it when I list it, so the insert worked yet the task never returned.
I am using VS2012 with.Net 4.5.1 - could that be it?
Any thought appreciated. Driving me nutz. Thank you.
Craig Wilson
unread,
Jun 10, 2015, 9:38:12 PM6/10/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
You are probably deadlocking. In all places where you are doing an await, add a ConfigureAwait(false) to the end:
await collection.InsertOneAsync(new Book { name = "Get there please" }).ConfigureAwait(false);
Craig
pbu...@compuserve.com
unread,
Jun 11, 2015, 11:31:39 AM6/11/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongod...@googlegroups.com
Absolutely fixed it. Thanks Craig. Appreciate your time very much.