Fix PoliCheck violations.
This commit is contained in:
parent
e8cc1106d8
commit
bb1b49cc1c
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNet.DataProtection.Repositories
|
||||||
|
|
||||||
public virtual IReadOnlyCollection<XElement> GetAllElements()
|
public virtual IReadOnlyCollection<XElement> GetAllElements()
|
||||||
{
|
{
|
||||||
// force complete enumeration under lock to avoid races
|
// force complete enumeration under lock for thread safety
|
||||||
lock (_storedElements)
|
lock (_storedElements)
|
||||||
{
|
{
|
||||||
return GetAllElementsCore().ToList().AsReadOnly();
|
return GetAllElementsCore().ToList().AsReadOnly();
|
||||||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNet.DataProtection.Repositories
|
||||||
{
|
{
|
||||||
XElement cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
|
XElement cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it
|
||||||
|
|
||||||
// under lock to avoid races
|
// under lock for thread safety
|
||||||
lock (_storedElements)
|
lock (_storedElements)
|
||||||
{
|
{
|
||||||
_storedElements.Add(cloned);
|
_storedElements.Add(cloned);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue