Skip to content

Commit 98774d5

Browse files
Remove Backport.System.Threading.Lock dependency (#4724)
* Remove Backport.System.Threading.Lock dependency * Remove Backport.System.Threading.Lock dependency from test projects
1 parent d4a13fd commit 98774d5

File tree

16 files changed

+45
-62
lines changed

16 files changed

+45
-62
lines changed

Source/Csla.Analyzers/Csla.Analyzers/Csla.Analyzers.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,4 @@
4141
</EmbeddedResource>
4242
</ItemGroup>
4343

44-
<ItemGroup>
45-
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.4" />
46-
<Using Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="System.Threading.Lock" />
47-
<Using Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="Backport.System.Threading.Lock" />
48-
<Using Alias="LockFactory" Include="Backport.System.Threading.LockFactory" />
49-
</ItemGroup>
50-
5144
</Project>

Source/Csla.Channels.RabbitMq/Csla.Channels.RabbitMq.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,4 @@
2626
<ProjectReference Include="..\Csla\Csla.csproj" />
2727
</ItemGroup>
2828

29-
<ItemGroup>
30-
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.4" />
31-
<Using Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="System.Threading.Lock" />
32-
<Using Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="Backport.System.Threading.Lock" />
33-
<Using Alias="LockFactory" Include="Backport.System.Threading.LockFactory" />
34-
</ItemGroup>
35-
3629
</Project>

Source/Csla.Channels.RabbitMq/ProxyListener.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ private async Task InitializeRabbitMQ()
109109
}
110110

111111
private volatile bool IsListening;
112-
private readonly Lock ListeningLock = LockFactory.Create();
112+
#if NET9_0_OR_GREATER
113+
private readonly Lock ListeningLock = new();
114+
#else
115+
private readonly object ListeningLock = new();
116+
#endif
113117

114118
public async Task StartListening()
115119
{

Source/Csla.Generators/cs/AutoImplementProperties/Csla.Generator.AutoImplementProperties.Attributes.CSharp/Csla.Generator.AutoImplementProperties.Attributes.CSharp.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,4 @@
1818
<DelaySign>false</DelaySign>
1919
<SignAssembly>true</SignAssembly>
2020
</PropertyGroup>
21-
22-
<ItemGroup>
23-
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.4" />
24-
<Using Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="System.Threading.Lock" />
25-
<Using Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="Backport.System.Threading.Lock" />
26-
<Using Alias="LockFactory" Include="Backport.System.Threading.LockFactory" />
27-
</ItemGroup>
2821
</Project>

Source/Csla.Generators/cs/AutoImplementProperties/Csla.Generator.AutoImplementProperties.CSharp/Csla.Generator.AutoImplementProperties.CSharp.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,14 @@
3939
</ItemGroup>
4040

4141
<ItemGroup>
42-
<ProjectReference Include="..\Csla.Generator.AutoImplementProperties.Attributes.CSharp\Csla.Generator.AutoImplementProperties.Attributes.CSharp.csproj"
43-
PrivateAssets="All"/>
42+
<ProjectReference Include="..\Csla.Generator.AutoImplementProperties.Attributes.CSharp\Csla.Generator.AutoImplementProperties.Attributes.CSharp.csproj" PrivateAssets="All" />
4443
</ItemGroup>
4544

4645
<ItemGroup>
4746
<PackageReference Include="Polyfill" Version="7.4.0">
4847
<PrivateAssets>all</PrivateAssets>
4948
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
5049
</PackageReference>
51-
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.4" />
52-
<Using Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="System.Threading.Lock" />
53-
<Using Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="Backport.System.Threading.Lock" />
54-
<Using Alias="LockFactory" Include="Backport.System.Threading.LockFactory" />
5550
</ItemGroup>
5651

5752
</Project>

Source/Csla.Generators/cs/AutoSerialization/Csla.Generator.AutoSerialization.Attributes.CSharp/Csla.Generator.AutoSerialization.Attributes.CSharp.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,4 @@
1717
<DelaySign>false</DelaySign>
1818
<SignAssembly>true</SignAssembly>
1919
</PropertyGroup>
20-
21-
<ItemGroup>
22-
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.4" />
23-
<Using Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="System.Threading.Lock" />
24-
<Using Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="Backport.System.Threading.Lock" />
25-
<Using Alias="LockFactory" Include="Backport.System.Threading.LockFactory" />
26-
</ItemGroup>
2720
</Project>

Source/Csla.Generators/cs/AutoSerialization/Csla.Generator.AutoSerialization.CSharp/Csla.Generator.AutoSerialization.CSharp.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,14 @@
3838
</ItemGroup>
3939

4040
<ItemGroup>
41-
<ProjectReference Include="..\Csla.Generator.AutoSerialization.Attributes.CSharp\Csla.Generator.AutoSerialization.Attributes.CSharp.csproj"
42-
PrivateAssets="All" />
41+
<ProjectReference Include="..\Csla.Generator.AutoSerialization.Attributes.CSharp\Csla.Generator.AutoSerialization.Attributes.CSharp.csproj" PrivateAssets="All" />
4342
</ItemGroup>
4443

4544
<ItemGroup>
4645
<PackageReference Include="Polyfill" Version="7.4.0">
4746
<PrivateAssets>all</PrivateAssets>
4847
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
4948
</PackageReference>
50-
<PackageReference Include="Backport.System.Threading.Lock" Version="3.1.4" />
51-
<Using Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="System.Threading.Lock" />
52-
<Using Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))" Alias="Lock" Include="Backport.System.Threading.Lock" />
53-
<Using Alias="LockFactory" Include="Backport.System.Threading.LockFactory" />
5449
</ItemGroup>
5550

5651
</Project>

Source/Csla/ApplicationContext.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ public IContextDictionary LocalContext
106106
}
107107
}
108108

109-
private readonly Lock _syncContext = LockFactory.Create();
109+
#if NET9_0_OR_GREATER
110+
private readonly Lock _syncContext = new();
111+
#else
112+
private readonly object _syncContext = new();
113+
#endif
110114

111115
/// <summary>
112116
/// Returns the application-specific context data provided

Source/Csla/Core/BusinessBase.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3849,7 +3849,11 @@ protected override void OnSetChildren(SerializationInfo info, MobileFormatter fo
38493849
protected internal class BypassPropertyChecksObject : IDisposable
38503850
{
38513851
private BusinessBase? _businessObject;
3852-
private static Lock _lock = LockFactory.Create();
3852+
#if NET9_0_OR_GREATER
3853+
private static Lock _lock = new();
3854+
#else
3855+
private static object _lock = new();
3856+
#endif
38533857

38543858
internal BypassPropertyChecksObject(BusinessBase businessObject)
38553859
{

Source/Csla/Core/FieldManager/PropertyInfoManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public override int Compare(IPropertyInfo? x, IPropertyInfo? y)
3636
/// </summary>
3737
public static class PropertyInfoManager
3838
{
39-
private static readonly Lock _cacheLock = LockFactory.Create();
39+
#if NET9_0_OR_GREATER
40+
private static readonly Lock _cacheLock = new();
41+
#else
42+
private static readonly object _cacheLock = new();
43+
#endif
4044

4145
#if NET8_0_OR_GREATER
4246
private static ConcurrentDictionary<Type, Tuple<string?, PropertyInfoList>>? _propertyInfoCache;

0 commit comments

Comments
 (0)