You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This correct. You just can add the item without first trying if it is already there.
Evangelink
changed the title
Quality check misunderstands 'Dictionary.TryAdd'
Fix S4158: Rule should consider .NetCore 2.0+ 'Dictionary.TryAdd' method
Mar 21, 2019
Thank you for the feedback!
I confirm that I can reproduce the issue and that this is a False Positive on our side. The problem is that we actually don't cover this TryAdd method as it is a .NetCore specific method.
Quality check misunderstands 'Dictionary.TryAdd' and raises the following issue
Example:
var contents = new Dictionary<string, CmsContent>();
if (!contents.TryAdd(item.ID, new CmsContent { Text = item.Value.Value }))
{
//do something
}
The text was updated successfully, but these errors were encountered: