Skip to content

Commit d69ba1d

Browse files
committed
Replaced Dictionary with ConcurrentDictionary in HierarchicalLifetimeManager
1 parent 6f26e9d commit d69ba1d

File tree

3 files changed

+1953
-4
lines changed

3 files changed

+1953
-4
lines changed

src/Lifetime/HierarchicalLifetimeManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
2-
3-
using System;
1+
using System;
2+
using System.Collections.Concurrent;
43
using System.Collections.Generic;
54
using System.Linq;
65

@@ -16,7 +15,8 @@ public class HierarchicalLifetimeManager : SynchronizedLifetimeManager,
1615
{
1716
#region Fields
1817

19-
private readonly IDictionary<ILifetimeContainer, object> _values = new Dictionary<ILifetimeContainer, object>();
18+
private readonly IDictionary<ILifetimeContainer, object> _values =
19+
new ConcurrentDictionary<ILifetimeContainer, object>();
2020

2121
#endregion
2222

src/Unity.Abstractions.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<RootNamespace>Unity</RootNamespace>
2323
</PropertyGroup>
2424

25+
<ItemGroup Condition="'$(TargetFramework)' != '' AND '$(TargetFramework)' != 'netstandard1.0' ">
26+
<Compile Remove="Utility\ConcurrentDictionary.cs" />
27+
</ItemGroup>
28+
2529
<ItemGroup Condition="'$(TargetFramework)' != '' AND $(TargetFramework.StartsWith('netcoreapp'))">
2630
<Compile Remove="Exceptions\ResolutionFailedException.Desktop.cs" />
2731
<Compile Remove="Exceptions\IllegalInjectionMethodException.Desktop.cs" />

0 commit comments

Comments
 (0)