stride3d/stride · error · ArgumentNullException
antialiasShaderName
Error message
antialiasShaderName
What it means
The FXAAEffect(string antialiasShaderName) constructor throws ArgumentNullException when the shader name is null. FXAA is implemented as a shader effect that must be instantiated by name, so a null name would fail downstream when the effect is compiled. The check happens before the value reaches the base class constructor body.
Solutions
- Pass a valid shader name, e.g. new FXAAEffect("FXAAEffect") or the standard Stride FXAA shader name.
- If the name comes from config, validate it is non-null/non-empty before constructing the effect.
- Fall back to a default shader name constant when the configured value is missing.
Example fix
// before var fxaa = new FXAAEffect(settings.FxaaShaderName); // null // after var shaderName = settings.FxaaShaderName ?? "FXAAEffect"; var fxaa = new FXAAEffect(shaderName);
Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(shaderName)) shaderName = "FXAAEffect"; var fxaa = new FXAAEffect(shaderName);
Type guard
bool IsValidShaderName(string s) => !string.IsNullOrEmpty(s);
Try / catch
try { var fxaa = new FXAAEffect(name); }
catch (ArgumentNullException ex) { Log.Error(ex, "FXAA shader name missing"); } Prevention
- Use named constants for shader names
- Validate config-provided effect names before construction
- Provide default fallback shader names
When it happens
Trigger: new FXAAEffect(null) — constructing the anti-aliasing effect without a shader name, typically when the name is read from configuration or derived dynamically and ends up null.
Common situations: Configuration keys for post-effects not set; loading effect names from a settings file that omits the FXAA entry; refactoring where the default shader name constant was removed.
Related errors
- colorTransformShader
- value
- No EffectName specified
- Value cannot be null. (Parameter 'location')
- Value cannot be null. (Parameter 'asset')
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/3d620ad2f791bd99.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Rendering/Rendering/Images/AntiAliasing/FXAAEffect.cs:69
/// <summary>
/// Gets or sets a value indicating whether the luminance will be retrieved from the alpha channel of the input color. Otherwise, the green component of the input color is used as a luminance.
/// </summary>
/// <value><c>true</c> the luminance will be retrieved from the alpha channel of the input color. Otherwise, the green component of the input color is used as a luminance.</value>
/// <userdoc>Retrieve the luminance from the alpha channel of the input color. Otherwise, use the green component of the input color as an approximation of the luminance.</userdoc>
[DataMember(30)]
[DefaultValue(true)]
[Display("Input luminance from alpha")]
public bool InputLuminanceInAlpha { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="FXAAEffect"/> class.
/// </summary>
/// <param name="antialiasShaderName">Name of the antialias shader.</param>
/// <exception cref="System.ArgumentNullException">antialiasShaderName</exception>
public FXAAEffect(string antialiasShaderName) : base(antialiasShaderName)
{
if (antialiasShaderName == null) throw new ArgumentNullException("antialiasShaderName");
}
public static (int, int) GetQualityRange(DitherType dither)
{
// Returns valid ranges for FXAA_QUALITY__PRESET (as in FXAAShader.sdsl)
switch (dither)
{
case DitherType.Medium:
return (0, 5);
case DitherType.Low:
return (0, 9);
case DitherType.None:
return (9, 9);
default:
throw new ArgumentOutOfRangeException(nameof(Dither));
}
}
View on GitHub (pinned to 96fad776d2)