-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.24.0
-
Component/s: Configuration
-
Dotnet Drivers
Summary
It looks like the same EnumRepresentationConvention is being registered to the ConventionRegistry over and over again, even if its only set up once in the application lifecycle.
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 Version="2.24.0"
How to Reproduce
In the Startup.cs class, add EnumRepresentationConvention to the ConventionRegistry
Eg.
var pack = new ConventionPack { new EnumRepresentationConvention(BsonType.String) };
ConventionRegistry.Register("EnumStringConvention", pack, t => true);
Make any call to the desired repository, observe the ConventionRegistry growing with more than one of the same value by using the following command
Log.Information(JsonConvert.SerializeObject(ConventionRegistry.Lookup(typeof(EnumRepresentationConvention))));
Additional Background
We initially started an investigation around an OOM exception, and after some profiling we noticed that the ConvetionRegistry kept growing - on inspection of the items that it contains, it was found that the EnumRepresentation value was repeated.