Class SerializationException
Exception thrown when a serialization or deserialization operation performed by the Scylla serialization engine fails in a way that prevents the operation from completing successfully.
Implements
Inherited Members
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
[Serializable]
public class SerializationException : Exception, ISerializable
Remarks
SerializationException is the single exception type used throughout the Scylla serialization subsystem to report errors. Common scenarios in which it is thrown include:
- The PushDepth() call detects that the configured MaxDepth has been exceeded, which typically indicates a circular reference or an unexpectedly deep object graph.
- A cyclic reference is detected and the active ReferenceHandling policy is Error.
- The input data is malformed or contains tokens that the reader cannot interpret for the target type.
- An ITypeSerializer or ITypeSerializer<T> implementation encounters a value that violates its invariants.
When calling ScyllaSerialization methods, errors are returned as SerializationResult or SerializationResult<T> values rather than thrown exceptions. The exception message from any caught SerializationException is captured in ErrorMessage. Applications that construct custom ITypeSerializer<T> implementations should throw SerializationException to integrate cleanly with this pattern.
Constructors
SerializationException()
Initializes a new instance of SerializationException with no message. Prefer the overloads that accept a descriptive message when the failure context is known.
Declaration
public SerializationException()
SerializationException(string)
Initializes a new instance of SerializationException with a human-readable message describing the serialization failure.
Declaration
public SerializationException(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | A message that describes the error. Should include enough context to identify the type, field, or operation that failed (e.g., the type name being serialized and the reason the operation could not complete). |
SerializationException(string, Exception)
Initializes a new instance of SerializationException with a human-readable message and a reference to the lower-level exception that triggered the serialization failure.
Declaration
public SerializationException(string message, Exception innerException)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | A message that describes the serialization error. Should provide context about what the engine was attempting when the failure occurred. |
| Exception | innerException | The exception that is the root cause of this failure, or |