stride3d/stride · error · ArgumentNullException
compiler
Error message
compiler
What it means
EffectCompilerChain decorates another EffectCompilerBase; the constructor requires a non-null inner compiler and throws ArgumentNullException("compiler") otherwise. The chain cannot forward compile requests without it.
Solutions
- Construct the inner compiler (e.g. EffectCompiler or platform compiler) before wrapping it.
- Verify DI/factory registration for the base EffectCompilerBase.
- Guard the construction site and surface a clearer error when the base compiler is unavailable.
Example fix
// before var chain = new EffectCompilerChain(baseCompiler); // baseCompiler is null // after var baseCompiler = new EffectCompiler(fileProvider); var chain = new EffectCompilerChain(baseCompiler);
Defensive patterns
Strategy: validation
Validate before calling
if (baseCompiler == null) throw new InvalidOperationException("Inner compiler must be constructed before EffectCompilerChain"); Type guard
null
Try / catch
try { var chain = new EffectCompilerChain(baseCompiler); } catch (ArgumentNullException ex) when (ex.ParamName == "compiler") { /* construct base compiler and retry */ } Prevention
- Construct the base compiler first in factory code
- Check DI registration order for compiler services
- Return early with a clear error when compiler creation fails
When it happens
Trigger: new EffectCompilerChain(null), usually from a factory or DI setup where the base compiler failed to construct or was not registered.
Common situations: Building compiler chains (cache/scheduler wrappers) before the underlying compiler is initialized; conditional compiler setup paths that skip compiler creation.
Related errors
- A Gear constraint always needs two rigidbodies to be…
- adapter
- antialiasShaderName
- ArgumentNullException: deletedObjects
- ArgumentNullException: dependencyManager
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/4dd1d83aa8cca932.
Report an issue: GitHub.
Appendix: source
Thrown at sources/shaders/Stride.Shaders.Effects/Compiler/EffectCompilerChain.cs:21
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Stride.Core.Diagnostics;
using Stride.Core.IO;
using Stride.Core.Storage;
namespace Stride.Shaders.Compiler
{
/// <summary>
/// Helper class that delegates actual compilation to another <see cref="IEffectCompiler"/>.
/// </summary>
public class EffectCompilerChain : EffectCompilerBase
{
private readonly EffectCompilerBase compiler;
public EffectCompilerChain(EffectCompilerBase compiler)
{
if (compiler == null) throw new ArgumentNullException("compiler");
this.compiler = compiler;
}
protected EffectCompilerBase Compiler
{
get { return compiler; }
}
public override IVirtualFileProvider FileProvider
{
get { return compiler.FileProvider; }
set { compiler.FileProvider = value; }
}
protected override void Destroy()
{
compiler.Dispose();
View on GitHub (pinned to 96fad776d2)