Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:26:18+00:00 2026-06-08T09:26:18+00:00

Mongo C# driver (version 1.4.2) throw NullReferenceException from NLog.LogManager.GetCurrentClassLogger() Error happen only in the

  • 0

Mongo C# driver (version 1.4.2) throw NullReferenceException from NLog.LogManager.GetCurrentClassLogger()
Error happen only in the Release build. Works fine with debug build.
Not sure if it is related to NLog vs. Structuremap

Stack trace,

System.NullReferenceException
at NLog.LogManager.GetCurrentClassLogger()
at lambda_method(Closure )
at MongoDB.Bson.Serialization.BsonClassMap.CreateInstance() in C:\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization\BsonClassMap.cs:line 429
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
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
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
at MongoDB.Driver.Internal.MongoReplyMessage1.ReadFrom(BsonBuffer buffer, IBsonSerializationOptions serializationOptions) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Internal\MongoReplyMessage.cs:line 105
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
at MongoDB.Driver.MongoCursorEnumerator
1.GetReply(MongoConnection connection, MongoRequestMessage message) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 296
at MongoDB.Driver.MongoCursorEnumerator1.GetFirst() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 251
at MongoDB.Driver.MongoCursorEnumerator
1.MoveNext() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 141
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:26:19+00:00Added an answer on June 8, 2026 at 9:26 am

    The exception is not actually being thrown by the C# driver, but rather by some code outside the driver.

    Looking at the stack trace, we can see that the C# driver has read a document from the database and is trying to deserialize it (see BsonSerializer.Deserialize on the stack trace). As part of the deserialization it needs to create an instance of your class (see BsonClassMapSerializer.CreateInstance on the stack trace). The constructor of the object (or possibly a static constructor of the object’s class) is throwing a NullReferenceException.

    You probably know what class you are using here and can go look at your source code to figure out why NLog.LogManager (which is not part of the C# driver) is throwing a NullReferenceException.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Mongo LINQ Driver for C#, works great. Sorting a lot of
I'm retrieving results from mongo based on a geo query using the ruby driver.
Having some trouble issuing a simple query from the PHP Mongo driver. This is
The PHP Mongo Driver allows me to execute code in the database. Does this
I'm trying to get the latest Mongo Driver to work with MAMP 1.9.6 on
I am using the Mongo Ruby driver and have this block of Ruby code
I am trying 'mongo-ruby-driver' for some project. It's working fine except when I call
I am using mongo-ruby-driver, I want to get stats/query graphs to show for Mongo.
Uing Ruby (1.8.7) and Mongo Driver, I've written this: @data['Users'] = [] @database['user_facilities'].find({ :facility_id
How do I get a binary field from an existing mongo db document? At

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.