From 24dba7f76a32c9371f0ea26c4045972b600fd7dc Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Thu, 15 Aug 2024 20:45:43 +0200 Subject: [PATCH 01/19] Encourage use of System.Threading.Lock --- Directory.Packages.props | 1 + .../Volo.Abp.AspNetCore.Components.Web.csproj | 1 + .../AbpExceptionHandlingLoggerProvider.cs | 3 ++- .../Volo.Abp.AspNetCore.Mvc.csproj | 3 ++- .../CachedObjectExtensionsDtoService.cs | 3 ++- framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj | 3 +++ .../Volo.Abp.Localization/Volo.Abp.Localization.csproj | 1 + .../VirtualFileLocalizationResourceContributorBase.cs | 4 ++-- framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj | 1 + .../Volo/Abp/MongoDB/MongoModelBuilder.cs | 3 ++- .../Volo.Abp.ObjectExtending.csproj | 1 + .../Modularity/ModuleExtensionConfigurationHelper.cs | 3 ++- .../Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs | 10 ++++++++-- 13 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index b43886f7cf6..0fb61c83180 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,6 +17,7 @@ + diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo.Abp.AspNetCore.Components.Web.csproj b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo.Abp.AspNetCore.Components.Web.csproj index f43a89e7cc9..2ec1a3d72a8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo.Abp.AspNetCore.Components.Web.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo.Abp.AspNetCore.Components.Web.csproj @@ -8,6 +8,7 @@ enable Nullable + preview diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/AbpExceptionHandlingLoggerProvider.cs b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/AbpExceptionHandlingLoggerProvider.cs index d13fd5a7514..bcd2573f603 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/AbpExceptionHandlingLoggerProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo/Abp/AspNetCore/Components/Web/ExceptionHandling/AbpExceptionHandlingLoggerProvider.cs @@ -1,12 +1,13 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using System.Threading; namespace Volo.Abp.AspNetCore.Components.Web.ExceptionHandling; public class AbpExceptionHandlingLoggerProvider : ILoggerProvider { private AbpExceptionHandlingLogger? _logger; - private static readonly object SyncObj = new object(); + private static readonly Lock SyncObj = new Lock(); private readonly IServiceCollection _serviceCollection; public AbpExceptionHandlingLoggerProvider(IServiceCollection serviceCollection) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj index a6e2edc2cf0..b84992f0163 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj @@ -1,4 +1,4 @@ - + @@ -17,6 +17,7 @@ true Library + preview diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs index 10900f6ee47..fb0bc75bf49 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using Volo.Abp.DependencyInjection; using Volo.Abp.Localization; using Volo.Abp.ObjectExtending; @@ -13,7 +14,7 @@ public class CachedObjectExtensionsDtoService : ICachedObjectExtensionsDtoServic { protected IExtensionPropertyAttributeDtoFactory ExtensionPropertyAttributeDtoFactory { get; } protected volatile ObjectExtensionsDto? CachedValue; - protected readonly object SyncLock = new object(); + protected readonly Lock SyncLock = new Lock(); public CachedObjectExtensionsDtoService(IExtensionPropertyAttributeDtoFactory extensionPropertyAttributeDtoFactory) { diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj index 8804c8868f5..2e359c61e8e 100644 --- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj +++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj @@ -33,6 +33,9 @@ + + + diff --git a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj index 1c7b50b18e5..b9e915b95f7 100644 --- a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj +++ b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj @@ -14,6 +14,7 @@ false false + preview diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs index d87169ea312..49a23ae33f3 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; -using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Localization; @@ -19,7 +19,7 @@ public abstract class VirtualFileLocalizationResourceContributorBase : ILocaliza private IVirtualFileProvider _virtualFileProvider = default!; private Dictionary? _dictionaries; private bool _subscribedForChanges; - private readonly object _syncObj = new object(); + private readonly Lock _syncObj = new Lock(); private LocalizationResourceBase _resource = default!; protected VirtualFileLocalizationResourceContributorBase(string virtualPath) diff --git a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj index 789defab440..aa79dd068e4 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj +++ b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj @@ -14,6 +14,7 @@ false false + preview diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs index d7ad79f7d0b..a9f07a9e51b 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs @@ -10,6 +10,7 @@ using MongoDB.Driver; using Volo.Abp.Reflection; using Volo.Abp.Timing; +using System.Threading; namespace Volo.Abp.MongoDB; @@ -17,7 +18,7 @@ public class MongoModelBuilder : IMongoModelBuilder { private readonly Dictionary _entityModelBuilders; - private static readonly object SyncObj = new object(); + private static readonly Lock SyncObj = new Lock(); public MongoModelBuilder() { diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj b/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj index 76dc1c7c644..df87f694246 100644 --- a/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj +++ b/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj @@ -14,6 +14,7 @@ false false + preview diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs index 9a13b170287..b1e806468a7 100644 --- a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs +++ b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs @@ -1,12 +1,13 @@ using System; using System.Collections.Generic; +using System.Threading; using JetBrains.Annotations; namespace Volo.Abp.ObjectExtending.Modularity; public static class ModuleExtensionConfigurationHelper { - private static object SyncLock = new object(); + private static Lock SyncLock = new Lock(); public static void ApplyEntityConfigurationToEntity( string moduleName, diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs index 1d94122008a..2b82311bbee 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs @@ -10,6 +10,7 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.ExceptionHandling; using Volo.Abp.Threading; +using System.Threading; namespace Volo.Abp.RabbitMQ; @@ -35,7 +36,7 @@ public class RabbitMqMessageConsumer : IRabbitMqMessageConsumer, ITransientDepen protected ConcurrentQueue QueueBindCommands { get; } - protected object ChannelSendSyncLock { get; } = new object(); + protected Lock ChannelSendSyncLock { get; } = new Lock(); public RabbitMqMessageConsumer( IConnectionPool connectionPool, @@ -89,7 +90,8 @@ protected virtual async Task TrySendQueueBindCommandsAsync() return; } - lock (ChannelSendSyncLock) + ChannelSendSyncLock.Enter(); + try { if (QueueBindCommands.TryPeek(out var command)) { @@ -116,6 +118,10 @@ protected virtual async Task TrySendQueueBindCommandsAsync() QueueBindCommands.TryDequeue(out command); } } + finally + { + ChannelSendSyncLock.Exit(); + } } } catch (Exception ex) From 6214f61458e3e94920c70c3f49abde11cb166382 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Wed, 21 Aug 2024 15:07:05 +0200 Subject: [PATCH 02/19] Update Directory.Packages.props --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 0fb61c83180..6135ffe2330 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,7 +17,7 @@ - + From b71d4ec7fcf2dd7415c3ec10846abef29a2a902b Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Sun, 8 Sep 2024 12:55:20 +0200 Subject: [PATCH 03/19] Update Directory.Packages.props --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6135ffe2330..998d82c6e6f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,7 +17,7 @@ - + From fba82b1ffbed0f2f763da165d87e60b78ca518db Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Sun, 8 Sep 2024 13:04:30 +0200 Subject: [PATCH 04/19] Fix compilation issue --- .../Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj b/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj index df87f694246..a46156c1f34 100644 --- a/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj +++ b/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj @@ -22,4 +22,8 @@ + + + + From 4632c209ab5b01211f0d7e2c6c70d06cad8fd1c8 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Sun, 8 Sep 2024 13:17:56 +0200 Subject: [PATCH 05/19] Fix error --- .../Volo.Abp.ObjectExtending.csproj | 6 +----- .../Modularity/ModuleExtensionConfigurationHelper.cs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj b/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj index a46156c1f34..2dd22512a1b 100644 --- a/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj +++ b/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj @@ -1,4 +1,4 @@ - + @@ -22,8 +22,4 @@ - - - - diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs index b1e806468a7..266bdec76a0 100644 --- a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs +++ b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.ObjectExtending.Modularity; public static class ModuleExtensionConfigurationHelper { - private static Lock SyncLock = new Lock(); + private static object SyncLock = new(); public static void ApplyEntityConfigurationToEntity( string moduleName, From a8ab6c74a4693dd69b0739467a493f4e1188d3df Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Sat, 21 Sep 2024 19:42:42 +0200 Subject: [PATCH 06/19] Update Directory.Packages.props --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 998d82c6e6f..ad35fb350aa 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,7 +17,7 @@ - + From 7750026027d1d77a37b3917b67eaafdc682b0541 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Tue, 15 Oct 2024 09:14:18 +0200 Subject: [PATCH 07/19] Fix --- framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj index 669fa23cc93..cfac2325915 100644 --- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj +++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj @@ -16,6 +16,7 @@ + @@ -33,9 +34,6 @@ - - - From ae4680beb7d5abe48c60fc4cc7e2ce39b91d40ff Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Tue, 15 Oct 2024 09:16:37 +0200 Subject: [PATCH 08/19] Cleaned up --- .../VirtualFileLocalizationResourceContributorBase.cs | 1 - .../src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs | 1 - .../Modularity/ModuleExtensionConfigurationHelper.cs | 1 - .../Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs | 1 - 4 files changed, 4 deletions(-) diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs index 446e9bc407c..3191516c592 100644 --- a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs index 7ae86bdc72c..5782bb88c01 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/MongoDB/MongoModelBuilder.cs @@ -10,7 +10,6 @@ using MongoDB.Driver; using Volo.Abp.Reflection; using Volo.Abp.Timing; -using System.Threading; namespace Volo.Abp.MongoDB; diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs index 0423c8c2c8a..66d81cecf31 100644 --- a/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs +++ b/framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading; using JetBrains.Annotations; namespace Volo.Abp.ObjectExtending.Modularity; diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs index 98073fc69ca..46ba82f4945 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs @@ -10,7 +10,6 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.ExceptionHandling; using Volo.Abp.Threading; -using System.Threading; namespace Volo.Abp.RabbitMQ; From c4b7e402542a1c17fede3ed0a39d33733bf270a0 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Tue, 15 Oct 2024 09:21:18 +0200 Subject: [PATCH 09/19] Cleaning --- Directory.Build.props | 1 + .../Volo.Abp.AspNetCore.Components.Web.csproj | 1 - .../src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj | 1 - framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj | 1 - framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj | 1 - .../src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj | 1 - 6 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index c9240d6f484..a3d8f815ded 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,7 @@ true + preview diff --git a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo.Abp.AspNetCore.Components.Web.csproj b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo.Abp.AspNetCore.Components.Web.csproj index 9f40690406c..fb1a56949d9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo.Abp.AspNetCore.Components.Web.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Components.Web/Volo.Abp.AspNetCore.Components.Web.csproj @@ -8,7 +8,6 @@ enable Nullable - preview diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj index ac1a9deb8bf..a0cb70714c7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj @@ -17,7 +17,6 @@ true Library - preview diff --git a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj index 1fed90c6225..59f7772dc6e 100644 --- a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj +++ b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj @@ -14,7 +14,6 @@ false false - preview diff --git a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj index d0f343eb9a3..de1d337497b 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj +++ b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj @@ -14,7 +14,6 @@ false false - preview diff --git a/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj b/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj index 7a6e11320fd..c5bf37e570a 100644 --- a/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj +++ b/framework/src/Volo.Abp.ObjectExtending/Volo.Abp.ObjectExtending.csproj @@ -14,7 +14,6 @@ false false - preview From 84bab3384657c598add0f7b2307f3edb15919e66 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Tue, 15 Oct 2024 09:22:30 +0200 Subject: [PATCH 10/19] Revert Volo.Abp.AspNetCore.Mvc.csproj --- .../src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj index a0cb70714c7..cdfd58b2195 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj @@ -1,4 +1,4 @@ - + From cd126cb10864aef0d1990cd765c40352a223c795 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Tue, 15 Oct 2024 09:23:05 +0200 Subject: [PATCH 11/19] Revert Volo.Abp.ObjectExtending.csproj From 2b4e640533bb0d99efb315a0347a250016f8e291 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Tue, 15 Oct 2024 09:23:52 +0200 Subject: [PATCH 12/19] Revert Volo.Abp.ObjectExtending.csproj From 3399d9688d293a1d64462336e0045860ee334d18 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Tue, 15 Oct 2024 09:38:59 +0200 Subject: [PATCH 13/19] Fix so modules are unaffected --- Directory.Build.props | 7 ------- framework/Directory.Build.props | 13 +++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 framework/Directory.Build.props diff --git a/Directory.Build.props b/Directory.Build.props index a3d8f815ded..9724fee2232 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,6 @@ true - preview @@ -11,10 +10,4 @@ - - - - - - diff --git a/framework/Directory.Build.props b/framework/Directory.Build.props new file mode 100644 index 00000000000..53a7b62c428 --- /dev/null +++ b/framework/Directory.Build.props @@ -0,0 +1,13 @@ + + + + preview + + + + + + + + + From b31e0780691a87b063d8906ed3cc2c2bc5995040 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Tue, 15 Oct 2024 09:43:52 +0200 Subject: [PATCH 14/19] Fix import for directory.build.props --- framework/Directory.Build.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/Directory.Build.props b/framework/Directory.Build.props index 53a7b62c428..6b1338a1aa9 100644 --- a/framework/Directory.Build.props +++ b/framework/Directory.Build.props @@ -1,6 +1,7 @@ + + - preview From 6776802bff7d88ee4544aa47189697749bd92441 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Mon, 18 Nov 2024 08:56:45 +0100 Subject: [PATCH 15/19] Fix RabbitMqMessageConsumer --- .../Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs index aae4f02d30b..b9a435bfd2f 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs @@ -34,7 +34,7 @@ public class RabbitMqMessageConsumer : IRabbitMqMessageConsumer, ITransientDepen protected ConcurrentQueue QueueBindCommands { get; } - protected Lock ChannelSendSyncLock { get; } = LockFactory.Create(); + protected object ChannelSendSyncLock { get; } = new(); public RabbitMqMessageConsumer( IConnectionPool connectionPool, From ffad0f19f278107b6b9f7d394ef8406bee49e898 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Mon, 18 Nov 2024 08:57:27 +0100 Subject: [PATCH 16/19] Update Directory.Build.props --- Directory.Build.props | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9724fee2232..2bd2c92769d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,6 +8,5 @@ all runtime; build; native; contentfiles; analyzers - - + From 20219751877af27f81d62cc4ee6479d00dd34980 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Mon, 18 Nov 2024 08:58:05 +0100 Subject: [PATCH 17/19] Update Directory.Build.props --- Directory.Build.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2bd2c92769d..f6017501800 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,5 +8,6 @@ all runtime; build; native; contentfiles; analyzers - + + From 8fae92d86fbc05d5376875875836ef5ebc43e153 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Mon, 18 Nov 2024 08:59:20 +0100 Subject: [PATCH 18/19] Update RabbitMqMessageConsumer.cs --- .../Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs index b9a435bfd2f..6f361f76705 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs @@ -34,7 +34,7 @@ public class RabbitMqMessageConsumer : IRabbitMqMessageConsumer, ITransientDepen protected ConcurrentQueue QueueBindCommands { get; } - protected object ChannelSendSyncLock { get; } = new(); + protected object ChannelSendSyncLock { get; } = new object(); public RabbitMqMessageConsumer( IConnectionPool connectionPool, From 3909b3a75942b57a45206c387db17d0262b7ca6e Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Mon, 18 Nov 2024 09:17:17 +0100 Subject: [PATCH 19/19] Optimizations --- .../Mvc/UI/Bundling/BundleConfigurationCollection.cs | 5 +++-- .../Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleCacheItem.cs | 2 ++ .../Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs | 4 ++-- .../Volo/Abp/DynamicProxy/DynamicProxyIgnoreTypes.cs | 7 ++++--- framework/src/Volo.Abp.Core/Volo/Abp/RandomHelper.cs | 7 ++++--- .../Volo/Abp/Testing/Utils/TestCounter.cs | 7 ++++--- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs index 36e981e698c..dd02b380005 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleConfigurationCollection.cs @@ -10,6 +10,7 @@ public class BundleConfigurationCollection private readonly ConcurrentDictionary _bundles; private readonly ConcurrentDictionary>> _lazyBundleConfigurationActions; private readonly List> _lazyAllBundleConfigurationActions; + private readonly Lock _syncLock = new(); public BundleConfigurationCollection() { @@ -92,7 +93,7 @@ private BundleConfiguration CreateBundle(string bundleName, Action c.Invoke(bundle)); } @@ -146,7 +147,7 @@ public BundleConfigurationCollection ConfigureAll([NotNull] Action WatchDisposeHandles { get; } + public Lock SyncLock { get; } = new(); + public BundleCacheItem(List files) { Files = files; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs index 20c33e86e58..c28d7a3e25a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs @@ -138,13 +138,13 @@ private BundleCacheItem AddToBundleCache(string bundleName, IBundler bundler, Li private void WatchChanges(BundleCacheItem cacheValue, List files, string bundleRelativePath) { - lock (cacheValue.WatchDisposeHandles) + lock (cacheValue.SyncLock) { foreach (var file in files) { var watchDisposeHandle = HostingEnvironment.WebRootFileProvider.Watch(file).RegisterChangeCallback(_ => { - lock (cacheValue.WatchDisposeHandles) + lock (cacheValue.SyncLock) { cacheValue.WatchDisposeHandles.ForEach(h => h.Dispose()); cacheValue.WatchDisposeHandles.Clear(); diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/DynamicProxyIgnoreTypes.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/DynamicProxyIgnoreTypes.cs index d14f64a55bb..ecff01b3c6f 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/DynamicProxyIgnoreTypes.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/DynamicProxy/DynamicProxyIgnoreTypes.cs @@ -15,6 +15,7 @@ namespace Volo.Abp.DynamicProxy; public static class DynamicProxyIgnoreTypes { private static HashSet IgnoredTypes { get; } = new HashSet(); + private static readonly Lock _syncLock = LockFactory.Create(); public static void Add() { @@ -23,7 +24,7 @@ public static void Add() public static void Add(Type type) { - lock (IgnoredTypes) + lock (_syncLock) { IgnoredTypes.AddIfNotContains(type); } @@ -31,7 +32,7 @@ public static void Add(Type type) public static void Add(params Type[] types) { - lock (IgnoredTypes) + lock (_syncLock) { IgnoredTypes.AddIfNotContains(types); } @@ -39,7 +40,7 @@ public static void Add(params Type[] types) public static bool Contains(Type type, bool includeDerivedTypes = true) { - lock (IgnoredTypes) + lock (_syncLock) { return includeDerivedTypes ? IgnoredTypes.Any(t => t.IsAssignableFrom(type)) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/RandomHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/RandomHelper.cs index 0a5b3ffd05b..e9a2803aaf1 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/RandomHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/RandomHelper.cs @@ -12,6 +12,7 @@ namespace Volo.Abp; public static class RandomHelper { private static readonly Random Rnd = new Random(); + private static readonly Lock _syncLock = LockFactory.Create(); /// /// Returns a random number within a specified range. @@ -25,7 +26,7 @@ public static class RandomHelper /// public static int GetRandom(int minValue, int maxValue) { - lock (Rnd) + lock (_syncLock) { return Rnd.Next(minValue, maxValue); } @@ -42,7 +43,7 @@ public static int GetRandom(int minValue, int maxValue) /// public static int GetRandom(int maxValue) { - lock (Rnd) + lock (_syncLock) { return Rnd.Next(maxValue); } @@ -54,7 +55,7 @@ public static int GetRandom(int maxValue) /// A 32-bit signed integer greater than or equal to zero and less than . public static int GetRandom() { - lock (Rnd) + lock (_syncLock) { return Rnd.Next(); } diff --git a/framework/src/Volo.Abp.TestBase/Volo/Abp/Testing/Utils/TestCounter.cs b/framework/src/Volo.Abp.TestBase/Volo/Abp/Testing/Utils/TestCounter.cs index 1a364abf814..7c4f7bb9202 100644 --- a/framework/src/Volo.Abp.TestBase/Volo/Abp/Testing/Utils/TestCounter.cs +++ b/framework/src/Volo.Abp.TestBase/Volo/Abp/Testing/Utils/TestCounter.cs @@ -6,6 +6,7 @@ namespace Volo.Abp.Testing.Utils; public class TestCounter : ITestCounter, ISingletonDependency { private readonly Dictionary _values; + private readonly Lock _syncLock = LockFactory.Create(); public TestCounter() { @@ -24,7 +25,7 @@ public int Decrement(string name) public int Add(string name, int count) { - lock (_values) + lock (_syncLock) { var newValue = _values.GetOrDefault(name) + count; _values[name] = newValue; @@ -34,7 +35,7 @@ public int Add(string name, int count) public int GetValue(string name) { - lock (_values) + lock (_syncLock) { return _values.GetOrDefault(name); } @@ -42,7 +43,7 @@ public int GetValue(string name) public void ResetCount(string name) { - lock (_values) + lock (_syncLock) { _values[name] = 0; }