stride3d/stride · error · ArgumentNullException

msaaResolverShaderName

Error message

msaaResolverShaderName

What it means

The MSAAResolver constructor takes the names of the MSAA color-resolve and depth-resolve shaders and rejects a null color-resolve name with ArgumentNullException(msaaResolverShaderName). Both shader names are required to construct the resolve ImageEffectShaders.

Solutions

  1. Pass a valid resolve shader name, e.g. new MSAAResolver("MSAAResolverShader", "MSAADepthResolverShader")
  2. Fix the config/settings source that produced a null shader name
  3. Guard the call site and throw a descriptive error before constructing MSAAResolver

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try { resolver = new MSAAResolver(name, depthName); }
catch (ArgumentNullException ex) when (ex.ParamName == "msaaResolverShaderName") {
    // load default shader name from settings before retrying
}

Prevention

When it happens

Trigger: new MSAAResolver(null, someDepthShaderName) — passing null (uninitialized constant, failed config lookup) as the first constructor argument.

Common situations: Config-driven shader name lookups returning null when a shader key is missing; refactoring where the shader name constant was removed; DI containers injecting null defaults.

Related errors


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

Appendix: source

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

        public float FilterRadius { get; set; } = 1.0f;

        /// <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);

View on GitHub (pinned to 96fad776d2)