Skip to content

Add ConcurrentPropertyBag #531

@irineu

Description

@irineu

Hi, i'm trying the ClearScript solution in a specific scenario with concurrency. I've got an exception and i didn't found a solution on ClearScript docs for solve it:

System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at Microsoft.ClearScript.PropertyBag.Add(String key, Object value)

The error is in: Microsoft.ClearScript.PropertyBag.Add, and after look the source code of the PropertyBag class (https://github.com/microsoft/ClearScript/blob/ebd71aaf9e198b549a2e4dcdd8b61b21fefd7841/ClearScript/PropertyBag.cs#L36C9-L36C64), replacing the Dictionary to ConcurrentDictionary may solve this problem... But it will be nice if the ClearScript have an built in solution for deal with concurrency...

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions