abpframework/abp · warning · ArgumentNullException

concerns should be provided!

Error message

concerns should be provided!

What it means

AbpCrossCuttingConcerns.AddApplied tags an object (implementing IAvoidDuplicateCrossCuttingConcerns) with applied concern names like AbpAuditing / AbpUnitOfWork so interceptors do not run the same concern twice. The params string[] concerns array must be non-null and non-empty; passing none is treated as a programming error (ArgumentNullException). This is internal infrastructure invoked by ABP's auditing/UoW/feature interceptors.

Source

Thrown at framework/src/Volo.Abp.Core/Volo/Abp/Aspects/AbpCrossCuttingConcerns.cs:20

using System.Collections.Generic;
using JetBrains.Annotations;

namespace Volo.Abp.Aspects;

public static class AbpCrossCuttingConcerns
{
    //TODO: Move these constants to their own assemblies!

    public const string Auditing = "AbpAuditing";
    public const string UnitOfWork = "AbpUnitOfWork";
    public const string FeatureChecking = "AbpFeatureChecking";
    public const string GlobalFeatureChecking = "AbpGlobalFeatureChecking";

    public static void AddApplied(object obj, params string[] concerns)
    {
        if (concerns.IsNullOrEmpty())
        {
            throw new ArgumentNullException(nameof(concerns), $"{nameof(concerns)} should be provided!");
        }

        (obj as IAvoidDuplicateCrossCuttingConcerns)?.AppliedCrossCuttingConcerns.AddRange(concerns);
    }

    public static void RemoveApplied(object obj, params string[] concerns)
    {
        if (concerns.IsNullOrEmpty())
        {
            throw new ArgumentNullException(nameof(concerns), $"{nameof(concerns)} should be provided!");
        }

        var crossCuttingEnabledObj = obj as IAvoidDuplicateCrossCuttingConcerns;
        if (crossCuttingEnabledObj == null)
        {
            return;
        }

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Pass at least one concern constant, e.g. AddApplied(obj, AbpCrossCuttingConcerns.Auditing).
  2. If building the array dynamically, guard for null/empty before calling.
  3. Prefer the Applying(obj, concerns...) helper which also removes on dispose - and pass real concern names.

Example fix

// before
AbpCrossCuttingConcerns.AddApplied(obj); // throws

// after
AbpCrossCuttingConcerns.AddApplied(obj, AbpCrossCuttingConcerns.Auditing);
Defensive patterns

Strategy: validation

Validate before calling

if (concerns is null || concerns.Length == 0) return;
AbpCrossCuttingConcerns.AddApplied(obj, concerns);

Type guard

bool HasConcerns(string[] c) => c is not null && c.Length > 0;

Prevention

When it happens

Trigger: Calling AddApplied(obj) with no concern arguments, or explicitly passing a null/empty string array.

Common situations: A custom interceptor that calls AddApplied(obj) without specifying which concern; a refactor that drops a concern constant; calling Applying(obj) (which forwards to AddApplied) with no concerns.

Related errors


AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13). Data as JSON: /api/errors/d571d88d7ddf9f83. Report an issue: GitHub.