diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj index 535a907335..6e5cf50d57 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable true Volo.Abp.AspNetCore.Mvc.UI.Bundling Volo.Abp.AspNetCore.Mvc.UI.Bundling diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs index 285f8ea691..4b0efe54ab 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundlerBase.cs @@ -146,7 +146,7 @@ public abstract class BundlerBase : IBundler, ITransientDependency return false; } - protected virtual IFileInfo GetMinFileInfoOrNull(string file) + protected virtual IFileInfo? GetMinFileInfoOrNull(string file) { foreach (var suffix in _minFileSuffixes) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/CssRelativePath.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/CssRelativePath.cs index 93332bf575..c41f0ca4a4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/CssRelativePath.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/CssRelativePath.cs @@ -20,7 +20,7 @@ internal static class CssRelativePath return cssFileContents; } - var cssDirectoryPath = Path.GetDirectoryName(absoluteInputFilePath); + var cssDirectoryPath = Path.GetDirectoryName(absoluteInputFilePath)!; foreach (Match match in matches) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelper.cs index f069f20190..1240dbef11 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelper.cs @@ -10,12 +10,12 @@ public abstract class AbpBundleItemTagHelper : Ab /// /// A file path. /// - public string Src { get; set; } + public string? Src { get; set; } /// /// A bundle contributor type. /// - public Type Type { get; set; } + public Type? Type { get; set; } protected AbpBundleItemTagHelper(TTagHelperService service) : base(service) @@ -26,7 +26,7 @@ public abstract class AbpBundleItemTagHelper : Ab { if (Type != null) { - return Type.FullName; + return Type.FullName!; } if (Src != null) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelper.cs index d5fce59e4a..ca557436e9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelper.cs @@ -6,7 +6,7 @@ public abstract class AbpBundleTagHelper : AbpTagHelper where TService : class, IAbpTagHelperService { - public string Name { get; set; } + public string? Name { get; set; } protected AbpBundleTagHelper(TService service) : base(service) @@ -14,7 +14,7 @@ public abstract class AbpBundleTagHelper : AbpTagHelper bundleItems, - [CanBeNull] string bundleName = null) + string? bundleName = null) { Check.NotNull(viewContext, nameof(viewContext)); Check.NotNull(context, nameof(context)); @@ -55,9 +55,9 @@ public abstract class AbpTagHelperResourceService : ITransientDependency bundleName = GenerateBundleName(bundleItems); } - CreateBundle(bundleName, bundleItems); + CreateBundle(bundleName!, bundleItems); - var bundleFiles = await GetBundleFilesAsync(bundleName); + var bundleFiles = await GetBundleFilesAsync(bundleName!); output.Content.Clear(); @@ -68,7 +68,7 @@ public abstract class AbpTagHelperResourceService : ITransientDependency if (file == null || !file.Exists) { Logger.LogError($"Could not find the bundle file '{bundleFile}' for the bundle '{bundleName}'!"); - AddErrorScript(viewContext, tagHelper, context, output, bundleFile, bundleName); + AddErrorScript(viewContext, tagHelper, context, output, bundleFile, bundleName!); continue; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/BundleTagHelperContributorTypeItem.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/BundleTagHelperContributorTypeItem.cs index 5fac826e8b..bab02a9f97 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/BundleTagHelperContributorTypeItem.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/BundleTagHelperContributorTypeItem.cs @@ -6,7 +6,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers; public class BundleTagHelperContributorTypeItem : BundleTagHelperItem { [NotNull] - public Type Type { get; } + public Type Type { get; } = default!; public BundleTagHelperContributorTypeItem([NotNull] Type type) { @@ -15,7 +15,7 @@ public class BundleTagHelperContributorTypeItem : BundleTagHelperItem public override string ToString() { - return Type.FullName; + return Type.FullName!; } public override void AddToConfiguration(BundleConfiguration configuration) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/IBundleTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/IBundleTagHelper.cs index 233298c16c..74d936964e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/IBundleTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/IBundleTagHelper.cs @@ -2,5 +2,5 @@ public interface IBundleTagHelper { - string GetNameOrNull(); + string? GetNameOrNull(); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptNonceTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptNonceTagHelper.cs index 6c29c81073..08f99e3c0b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptNonceTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptNonceTagHelper.cs @@ -11,7 +11,7 @@ public class ScriptNonceTagHelper : AbpTagHelper { [HtmlAttributeNotBound] [ViewContext] - public ViewContext ViewContext { get; set; } + public ViewContext ViewContext { get; set; } = default!; public override void Process(TagHelperContext context, TagHelperOutput output) { if (ViewContext.HttpContext.Items.TryGetValue(AbpAspNetCoreConsts.ScriptNonceKey, out var nonce) && nonce is string nonceString && !string.IsNullOrEmpty(nonceString))