diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs index 578d010214..336594b130 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs @@ -182,8 +182,13 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency var versionAttribute = package.Attributes["Version"]; var currentVersion = versionAttribute.Value; - var currentSemanticVersion = SemanticVersion.Parse(currentVersion); - + var isVersionParsed = SemanticVersion.TryParse(currentVersion, out var currentSemanticVersion); + if (!isVersionParsed) + { + Logger.LogWarning("Could not parse package \"{0}\" version v{1}. Skipped.", packageId, currentVersion); + continue; + } + var isLeptonXPackage = packageId.Contains("LeptonX"); Logger.LogDebug("Checking package: \"{0}\" - Current version: {1}", packageId, currentSemanticVersion); @@ -194,7 +199,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency { continue; } - + if (await SpecifiedVersionExists(specifiedVersion, packageId)) { var specifiedSemanticVersion = SemanticVersion.Parse(specifiedVersion); @@ -235,12 +240,12 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency SemanticVersion latestVersion; if (currentSemanticVersion.IsPrerelease && !switchToStable) { - latestVersion = latestNugetReleaseCandidateVersion == null || isLeptonXPackage ? + latestVersion = latestNugetReleaseCandidateVersion == null || isLeptonXPackage ? await _nuGetService.GetLatestVersionOrNullAsync(packageId, includeReleaseCandidates: true) : latestNugetReleaseCandidateVersion; } else { - latestVersion = latestNugetVersion == null || isLeptonXPackage ? + latestVersion = latestNugetVersion == null || isLeptonXPackage ? await _nuGetService.GetLatestVersionOrNullAsync(packageId, includeReleaseCandidates: includeReleaseCandidates) : latestNugetVersion; } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs index f94be12ba1..893b5bbc1c 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs @@ -11,7 +11,7 @@ public abstract class FeatureCheckerBase : IFeatureChecker, ITransientDependency public virtual async Task IsEnabledAsync(string name) { var value = await GetOrNullAsync(name); - if (value == null) + if (value.IsNullOrEmpty()) { return false; } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs index 5ea7377fd7..14cd0d405b 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureDefinition.cs @@ -100,11 +100,11 @@ public class FeatureDefinition : ICanCreateChildFeature bool isVisibleToClients = true, bool isAvailableToHost = true) { - Name = name; + Name = Check.NotNullOrWhiteSpace(name, nameof(name)); DefaultValue = defaultValue; DisplayName = displayName ?? new FixedLocalizableString(name); Description = description; - ValueType = valueType; + ValueType = valueType ?? new ToggleStringValueType(); IsVisibleToClients = isVisibleToClients; IsAvailableToHost = isAvailableToHost; diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs index 618f52d7a1..0c181ab632 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureDefinitionRecord.cs @@ -70,7 +70,7 @@ public class FeatureDefinitionRecord : BasicAggregateRoot, IHasExtraProper DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), FeatureDefinitionRecordConsts.MaxDisplayNameLength); Description = Check.Length(description, nameof(description), FeatureDefinitionRecordConsts.MaxDescriptionLength); - DefaultValue = Check.NotNullOrWhiteSpace(defaultValue, nameof(defaultValue), FeatureDefinitionRecordConsts.MaxDefaultValueLength); + DefaultValue = Check.Length(defaultValue, nameof(defaultValue), FeatureDefinitionRecordConsts.MaxDefaultValueLength); IsVisibleToClients = isVisibleToClients; IsAvailableToHost = isAvailableToHost; diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs index f1a0a4bf3b..e85e246094 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo/Abp/FeatureManagement/EntityFrameworkCore/AbpFeatureManagementEntityFrameworkCoreTestModule.cs @@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Storage; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Sqlite; using Volo.Abp.Modularity; +using Volo.Abp.Uow; namespace Volo.Abp.FeatureManagement.EntityFrameworkCore; @@ -26,6 +27,11 @@ public class AbpFeatureManagementEntityFrameworkCoreTestModule : AbpModule abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); }); }); + + Configure(options => + { + options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; + }); } private static SqliteConnection CreateDatabaseAndGetConnection()