From 51efd8cfa0f09b0638e14138ba3617b836038e4b Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 12 Sep 2023 16:53:33 +0800 Subject: [PATCH 1/3] Add `NotNullWhen` attribute to `IsNullOrEmpty& IsNullOrWhiteSpace`. --- framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs index c7153264ae..2462f57d27 100644 --- a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Security.Cryptography; using System.Text; @@ -47,7 +48,7 @@ public static class AbpStringExtensions /// Indicates whether this string is null or an System.String.Empty string. /// [ContractAnnotation("str:null => true")] - public static bool IsNullOrEmpty(this string? str) + public static bool IsNullOrEmpty([NotNullWhen(false)]this string? str) { return string.IsNullOrEmpty(str); } @@ -56,7 +57,7 @@ public static class AbpStringExtensions /// indicates whether this string is null, empty, or consists only of white-space characters. /// [ContractAnnotation("str:null => true")] - public static bool IsNullOrWhiteSpace(this string? str) + public static bool IsNullOrWhiteSpace([NotNullWhen(false)]this string? str) { return string.IsNullOrWhiteSpace(str); } From b40653721a52a82798c51cea3e3a9d86554e90fd Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 12 Sep 2023 17:13:01 +0800 Subject: [PATCH 2/3] Add `Nullable` package. --- framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs | 5 ++--- framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs index 2462f57d27..3d44fa988a 100644 --- a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Security.Cryptography; using System.Text; @@ -48,7 +47,7 @@ public static class AbpStringExtensions /// Indicates whether this string is null or an System.String.Empty string. /// [ContractAnnotation("str:null => true")] - public static bool IsNullOrEmpty([NotNullWhen(false)]this string? str) + public static bool IsNullOrEmpty([System.Diagnostics.CodeAnalysis.NotNullWhen(false)]this string? str) { return string.IsNullOrEmpty(str); } @@ -57,7 +56,7 @@ public static class AbpStringExtensions /// indicates whether this string is null, empty, or consists only of white-space characters. /// [ContractAnnotation("str:null => true")] - public static bool IsNullOrWhiteSpace([NotNullWhen(false)]this string? str) + public static bool IsNullOrWhiteSpace([System.Diagnostics.CodeAnalysis.NotNullWhen(false)]this string? str) { return string.IsNullOrWhiteSpace(str); } diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj index c250d07eee..c526a93ad9 100644 --- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj +++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj @@ -33,6 +33,10 @@ + + all + runtime; build; native; contentfiles; analyzers + From 2e58ec353cc7521a4d4091506589fb655bfeea17 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 12 Sep 2023 20:18:39 +0800 Subject: [PATCH 3/3] Only add `Nullable` package for `NETStandard`. --- framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj | 8 +++++--- 1 file changed, 5 insertions(+), 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 c526a93ad9..9709051409 100644 --- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj +++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj @@ -33,12 +33,14 @@ + + + + + all runtime; build; native; contentfiles; analyzers - - -