stride3d/stride · error · ArgumentNullException
ObjectSerializerBackend can not be null
Error message
ObjectSerializerBackend can not be null
What it means
SerializerSettings.ObjectSerializerBackend supplies low-level object (de)serialization behavior and is mandatory. Assigning null throws ArgumentNullException to fail fast rather than crashing later mid-serialization with a NullReferenceException.
Solutions
- Assign an instance such as new DefaultObjectSerializerBackend() or your custom subclass
- Fix the DI registration/factory so it returns a non-null backend
Example fix
// before settings.ObjectSerializerBackend = ResolveBackend(); // null // after settings.ObjectSerializerBackend = ResolveBackend() ?? new DefaultObjectSerializerBackend();
Defensive patterns
Strategy: validation
Validate before calling
settings.ObjectSerializerBackend = backend ?? new DefaultObjectSerializerBackend();
Try / catch
try { settings.ObjectSerializerBackend = backend; } catch (ArgumentNullException) { settings.ObjectSerializerBackend = new DefaultObjectSerializerBackend(); } Prevention
- Fall back to DefaultObjectSerializerBackend when custom backends fail to resolve
- Verify DI registrations for custom backends in startup tests
When it happens
Trigger: `settings.ObjectSerializerBackend = null` or a factory method returning null for the backend.
Common situations: Overriding the backend via DI/config where the override resolution fails; typos in registration causing an unbound resolution.
Related errors
- NamingConvention can not be null
- specialCollectionMember can not be null
- Attributes can not be null
- ObjectFactory can not be null
- Expecting value > 0
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/e29cc051b92adb24.
Report an issue: GitHub.
Appendix: source
Thrown at sources/core/Stride.Core.Yaml/Serialization/SerializerSettings.cs:289
set
{
if (value == null)
throw new ArgumentNullException("value", $"{nameof(Attributes)} can not be null");
attributeRegistry = value;
}
}
/// <summary>
/// Gets or sets the ObjectSerializerBackend. Default implementation is <see cref="DefaultObjectSerializerBackend"/>
/// </summary>
/// <value>The ObjectSerializerBackend.</value>
public IObjectSerializerBackend ObjectSerializerBackend
{
get { return objectSerializerBackend; }
set
{
if (value == null)
throw new ArgumentNullException("value", $"{nameof(ObjectSerializerBackend)} can not be null");
objectSerializerBackend = value;
}
}
/// <summary>
/// Gets or sets the default factory to instantiate a type. Default is <see cref="DefaultObjectFactory" />.
/// </summary>
/// <value>The default factory to instantiate a type.</value>
/// <exception cref="System.ArgumentNullException">value</exception>
public IObjectFactory ObjectFactory
{
get { return objectFactory; }
set
{
if (value == null)
throw new ArgumentNullException("value", $"{nameof(ObjectFactory)} can not be null");
objectFactory = value;
}View on GitHub (pinned to 96fad776d2)