Home Dashboard Directory Help
Search

ConcurrentDictionary<TKey, TValue>.AddOrUpdate(TKey, Func<TKey, TValue>, Func<TKey, TValue, TValue>) by Tomáš Jecha


Status: 

Closed
 as Fixed Help for as Fixed


2
0
Sign in
to vote
Type: Bug
ID: 693563
Opened: 10/7/2011 5:58:08 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

If using ConcurrentDictionary, its AddOrUpdate method will call "addValueFactory" method more than once if this method is executed in more threads.

There is this line in documentation:
Adds a key/value pair ... if the key does not already exist, or updates a key/value pair ... if the key already exists.
http://msdn.microsoft.com/en-us/library/ee378675.aspx

There should be better documentation of how this works and there must be info, that addValueFactory can be called more than once and its value is not used and added to dictionary in some cases.
Details
Sign in to post a comment.
Posted by ChrisLaMont on 11/18/2012 at 2:23 PM
This is closed, and no update was posted as promised.

The documents haven't been updated. I've needed this information for quite some time now...
Posted by Microsoft on 10/21/2011 at 3:21 PM
Hi, and thank you for your suggestion. I agree that we can better describe how addValueFactory behaves when called from multiple threads. I will put this on my list of content enhancements to consider for a future release of the documentation. I will update you again when the issue is resolved. Thanks again!
Posted by MS-Moderator07 [Feedback Moderator] on 10/9/2011 at 9:39 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by MS-Moderator01 on 10/7/2011 at 6:42 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.