ConcurrentDictionary
See original GitHub issueHi,
When I use autofixture to generate a Dictionary<T, U>
I get values populated in it by default, but with a ConcurrentDictionary<T, U>
I don’t.
Is this by design & I should use a specimen builder to alter that behaviour myself, or is it a missing feature or bug?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
ConcurrentDictionary<TKey,TValue> Class
Represents a thread-safe collection of key/value pairs that can be accessed by multiple threads concurrently.
Read more >ConcurrentDictionary in C# - Introduction, Examples
ConcurrentDictionary is thread-safe collection class to store key/value pairs. It internally uses locking to provide you a thread-safe class. It provides ...
Read more >ConcurrentDictionary in C# - Detailed Guide
This class has an internal state represented by a simple Dictionary . Its processing requires multiple steps which can execute concurrently.
Read more >ConcurrentDictionary In C#
ConcurrentDictionary was introduced in .NET 4.0 and is available in the System.Collections.Concurrent namespace. It is thread-safe and ...
Read more >c# - Concurrent Dictionary Correct Usage
ConcurrentDictionary <TKey, TValue> is designed for multithreaded scenarios. You do not have to use locks in your code to add or remove items ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, I cannot tell the reasons behind this, but it looking at the source code the supported collections are hard coded. So it is not something like “does type implement IDictionary”, it is “is type Dictionary<,>”. Therefore ConcurrentDictionary does not work. You dont need to create your own specimenbuilder, you can use what is already there:
Just that I dont spread wrong information, it is is not only Dictionary<,>. I just wanted to point out that the list of types can be found directly in Fixture.cs. E.g. it is also SortedDictionary<,>, but as you already figured out, it is not ConcurrentDictionary<,>. By all means I would say that a future implementation should check for the interface.