stride3d/stride · error · ArgumentNullException

msaaDepthResolverShaderName

Error message

msaaDepthResolverShaderName

What it means

Same constructor as the color-resolve check, but for the DEPTH resolve shader name: MSAAResolver throws ArgumentNullException(msaaDepthResolverShaderName) when the second argument is null. The depth-resolve pass is required to resolve multisampled depth-stencil buffers.

Solutions

  1. Pass a valid depth-resolve shader name as the second constructor argument
  2. Fix the configuration lookup returning null for msaaDepthResolverShaderName
  3. Add a call-site guard/verbosity: fail early with the actual config key missing

Example fix

// before
new MSAAResolver("MSAAResolverShader", null);
// after
new MSAAResolver("MSAAResolverShader", "MSAADepthResolverShader");
Defensive patterns

Strategy: validation

Validate before calling

if (msaaDepthResolverShaderName == null)
    throw new InvalidOperationException("MSAA depth resolve shader name is required");
var resolver = new MSAAResolver(msaaResolverShaderName, msaaDepthResolverShaderName);

Type guard

static bool HasDepthShaderName((string color, string depth) shaders) =>
    !string.IsNullOrEmpty(shaders.depth);

Try / catch

try { resolver = new MSAAResolver(name, depthName); }
catch (ArgumentNullException ex) when (ex.ParamName == "msaaDepthResolverShaderName") {
    // supply the default depth-resolve shader name and retry
}

Prevention

When it happens

Trigger: new MSAAResolver("MSAAResolverShader", null) — passing null as the depth-resolve shader name.

Common situations: Depth resolve being optional in older codepaths and later made mandatory; settings lookups returning null for the depth shader key; copy-paste refactors dropping the second argument's initialization.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/Compositing/MSAAResolver.cs:116

        /// <summary>
        /// Initializes a new instance of the <see cref="MSAAResolver"/> class.
        /// </summary>
        public MSAAResolver()
            : this("MSAAResolverEffect", "MSAADepthResolverEffect")
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="MSAAResolver"/> class.
        /// </summary>
        /// <param name="msaaResolverShaderName">Name of the MSAA resolve pass shader.</param>
        /// <param name="msaaDepthResolverShaderName">Name of the MSAA depth resolve pass shader.</param>
        public MSAAResolver(string msaaResolverShaderName, string msaaDepthResolverShaderName)
            : base(msaaResolverShaderName)
        {
            if (msaaResolverShaderName == null) throw new ArgumentNullException(nameof(msaaResolverShaderName));
            if (msaaDepthResolverShaderName == null) throw new ArgumentNullException(nameof(msaaDepthResolverShaderName));

            msaaResolver = new ImageEffectShader(msaaResolverShaderName);
            msaaDepthResolver = new ImageEffectShader(msaaDepthResolverShaderName);

            EnableSetRenderTargets = false;
        }

        /// <summary>
        /// Resolves the specified input multisampled texture.
        /// </summary>
        /// <param name="drawContext">The draw context.</param>
        /// <param name="input">The input.</param>
        /// <param name="output">The output.</param>
        public void Resolve(RenderDrawContext drawContext, Texture input, Texture output)
        {
            SetInput(0, input);
            SetOutput(output);
            Draw(drawContext);

View on GitHub (pinned to 96fad776d2)