title: Mongo C# driver NullReferenceException with NLog.LogManager.GetCurrentClassLogger()
body: <p>Mongo C# driver (version 1.4.2) throw NullReferenceException from NLog.LogManager.GetCurrentClassLogger()<br>
  Error happen only in the Release build. Works fine with debug build.<br>
  Not sure if it is related to <a href="http://nlog-forum.1685105.n2.nabble.com/NLog-vs-Structuremap-td6603597.html" rel="nofollow">NLog vs. Structuremap </a></p>
  
  <p>Stack trace,</p>
  
  <p>System.NullReferenceException<br>
  at NLog.LogManager.GetCurrentClassLogger()<br>
  at lambda_method(Closure )<br>
  at MongoDB.Bson.Serialization.BsonClassMap.CreateInstance() in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonClassMap.cs:line 429<br>
  at MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize(BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs:line 111<br>
  at MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs:line 78<br>
  at MongoDB.Bson.Serialization.BsonSerializer.Deserialize(BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonSerializer.cs:line 223<br>
  at MongoDB.Driver.Internal.MongoReplyMessage<code>1.ReadFrom(BsonBuffer buffer, IBsonSerializationOptions serializationOptions) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Internal\MongoReplyMessage.cs:line 105<br>
  at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument](BsonBinaryReaderSettings readerSettings, IBsonSerializationOptions serializationOptions) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Internal\MongoConnection.cs:line 442<br>
  at MongoDB.Driver.MongoCursorEnumerator</code>1.GetReply(MongoConnection connection, MongoRequestMessage message) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 296<br>
  at MongoDB.Driver.MongoCursorEnumerator<code>1.GetFirst() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 251<br>
  at MongoDB.Driver.MongoCursorEnumerator</code>1.MoveNext() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 141<br>
  at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)  </p>