[CSHARP-4870] CreateCluster throws NullReferenceException when not setting LoggingSettings Created: 14/Dec/23 Updated: 18/Dec/23 Resolved: 15/Dec/23 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 2.23.0 |
| Fix Version/s: | 2.23.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Remco Ros | Assignee: | Boris Dogadov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Documentation Changes: | Not Needed | ||||||||||||||||||||
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
||||||||||||||||||||
| Description |
Summary
The cause of this is that on line #131 in ClusterFactory.cs 'loggerFactory.CreateLogger' is used. loggerFactory can be null, so that throws a NRE. The pattern used in other places is to use MongoDB Drivers' own extension method: 'loggerFactory.CreateEventLogger', the latter has proper null checks for when 'loggerFactory' is null. Proposed solution: change that line to use 'loggerFactory.CreateEventLogger(..)' Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).MongoDB.Driver 2.23 How to ReproduceUse a 'MongoClient' instance without specifying LoggingSettings. Additional Background- |
| Comments |
| Comment by PM Bot [ 14/Dec/23 ] |
|
Hi remcoros@live.nl, thank you for reporting this issue! The team will look into it and get back to you soon. |