stride3d/stride · error · ArgumentNullException
colorTransformShader
Error message
colorTransformShader
What it means
The protected ColorTransformBase(string colorTransformShader) constructor throws ArgumentNullException when the shader name is null. Color transforms are shader-driven image effects; the name is used to build a ShaderMixinGeneratorSource, which cannot be created from null. The doc comment also documents this as ArgumentNullException for the shader name.
Solutions
- Pass a non-null shader name when invoking the base constructor of your ColorTransform subclass.
- Validate the configured shader name before constructing the transform.
- Define the shader name as a compile-time constant in the subclass to avoid nulls.
Example fix
// before
public MyTransform() : base(shaderName) { } // shaderName null
// after
public MyTransform() : base("MyTransformShader") { } Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(name)) throw new ArgumentException("Shader name required");
base(name); Type guard
bool IsValid(string s) => !string.IsNullOrEmpty(s);
Try / catch
try { var t = new MyTransform(name); }
catch (ArgumentNullException ex) { Log.Error(ex, "Color transform shader name missing"); } Prevention
- Pass shader names as compile-time constants in subclasses
- Never forward nullable config strings directly to base constructors
- Chain-validate constructor arguments before base calls where possible
When it happens
Trigger: Calling a derived color-transform class constructor with a null shader name, e.g. new MyTransform(null), usually when the name is passed through from configuration or a constant that is null.
Common situations: Custom ColorTransform subclasses forwarding an uninitialized name field; config-driven effect pipelines where the transform's shader entry is missing.
Related errors
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/2a7fbefbc3f0364d.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Rendering/Rendering/Images/ColorTransforms/ColorTransformBase.cs:29
namespace Stride.Rendering.Images
{
/// <summary>
/// Base class for a <see cref="ColorTransformBase"/> used by <see cref="ColorTransform"/> and <see cref="ToneMapOperator"/>.
/// </summary>
[DataContract(Inherited = true)]
public abstract class ColorTransformBase
{
private ParameterCollection.CompositionCopier parameterCompositionCopier;
/// <summary>
/// Initializes a new instance of the <see cref="ColorTransformBase" /> class.
/// </summary>
/// <param name="colorTransformShader">Name of the shader.</param>
/// <exception cref="System.ArgumentNullException">shaderName</exception>
protected ColorTransformBase(string colorTransformShader)
{
if (colorTransformShader == null) throw new ArgumentNullException("colorTransformShader");
Parameters = new ParameterCollection();
// Initialize all Parameters with values coming from each ParameterKey
InitializeProperties();
Shader = new ShaderMixinGeneratorSource(colorTransformShader);
}
/// <summary>
/// Gets the group this <see cref="ColorTransformBase" /> is associated with.
/// </summary>
[DataMemberIgnore]
public ColorTransformGroup Group { get; internal set; }
/// <summary>
/// Gets or sets the shader source for this color transform.
/// </summary>
[DataMemberIgnore]View on GitHub (pinned to 96fad776d2)