stride3d/stride · error · ArgumentNullException

No EffectName specified

Error message

No EffectName specified

What it means

ImageEffectShader.InitializeCore throws ArgumentNullException with the message "No EffectName specified" when the EffectName property is null at initialization time. A valid effect name is required to compile/locate the shader effect. (Note: the message resembles ArgumentException text but is thrown as ArgumentNullException.)

Solutions

  1. Override the EffectName property in your subclass and return the shader asset name
  2. Verify the shader effect asset with that name exists in the project
  3. Ensure EffectName is set before the render system calls Initialize

Example fix

// before
public class MyEffect : ImageEffectShader { } // EffectName never overridden
// after
public class MyEffect : ImageEffectShader
{
    public override string EffectName => "MyEffectShader";
}
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(EffectName)) throw new InvalidOperationException("Subclass must override EffectName");

Try / catch

try { renderEffect.Initialize(context); } catch (ArgumentNullException) { /* set EffectName and re-register */ }

Prevention

When it happens

Trigger: Subclassing ImageEffectShader and forgetting to override EffectName; setting EffectName only after DrawCore runs (initialization happens earlier); deriving via a base class that leaves EffectName null.

Common situations: Copy-pasting a custom post effect skeleton without filling in EffectName; renaming a shader and accidentally removing the override; registering the effect with the render system before configuring it.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/098108413909169e. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/Images/ImageEffectShader.cs:70

        {
            EffectInstance = new DynamicEffectInstance(effectName, Parameters);
            EnableSetRenderTargets = !delaySetRenderTargets;
            this.delaySetRenderTargets = delaySetRenderTargets;
            if (effectName != null)
                Name = effectName;
        }

        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            pipelineState = new MutablePipelineState(Context.GraphicsDevice);
            pipelineState.State.SetDefaults();
            pipelineState.State.InputElements = PrimitiveQuad.VertexDeclaration.CreateInputElements();
            pipelineState.State.PrimitiveType = PrimitiveQuad.PrimitiveType;

            if (EffectName == null) throw new ArgumentNullException("No EffectName specified");

            // Setup the effect compiler
            EffectInstance.Initialize(Context.Services);

            // We give ImageEffectShader a higher priority, since they are usually executed serially and blocking
            EffectInstance.EffectCompilerParameters.TaskPriority = -1;

            SetDefaultParameters();
        }

        /// <summary>
        /// The current effect instance.
        /// </summary>
        [DataMemberIgnore]
        public DynamicEffectInstance EffectInstance { get; private set; }

        /// <summary>
        /// Effect name.

View on GitHub (pinned to 96fad776d2)