Table of Contents

Class SchemaMismatchException

Namespace
Excalibur.Dispatch.Serialization.Avro
Assembly
Excalibur.Dispatch.Serialization.Avro.dll

Thrown when an Avro payload's writer-schema fingerprint does not match the reader's schema and no compatible writer schema can be resolved, so the payload cannot be decoded safely.

public sealed class SchemaMismatchException : ApiException, ISerializable
Inheritance
SchemaMismatchException
Implements
Inherited Members
Extension Methods

Remarks

Apache Avro binary is not self-describing: correct decoding requires the writer schema. The base AvroSerializer frames every payload with the Avro single-object-encoding header (0xC3 0x01 + the 8-byte little-endian CRC-64-AVRO Rabin fingerprint of the writer schema). On read, a writer/reader fingerprint mismatch with no resolvable writer schema is a fail-closed condition: the serializer throws this exception instead of positionally decoding against the wrong schema (which would silently corrupt field values).

This is the structural guarantee behind "no silent corruption on version skew" — a skew is detected and rejected loudly, never mis-decoded.

Constructors

SchemaMismatchException()

Initializes a new instance of the SchemaMismatchException class.

public SchemaMismatchException()

SchemaMismatchException(string)

Initializes a new instance of the SchemaMismatchException class.

public SchemaMismatchException(string message)

Parameters

message string

The message that describes the error.

SchemaMismatchException(string, Exception)

Initializes a new instance of the SchemaMismatchException class.

public SchemaMismatchException(string message, Exception innerException)

Parameters

message string

The message that describes the error.

innerException Exception

The exception that is the cause of the current exception.

Properties

ReaderFingerprint

Gets the reader-schema fingerprint, if available.

public long? ReaderFingerprint { get; init; }

Property Value

long?

The CRC-64-AVRO Rabin fingerprint of the reader schema.

TargetType

Gets the type that was being deserialized when the mismatch was detected.

public Type? TargetType { get; init; }

Property Value

Type

The reader type, or null if not available.

WriterFingerprint

Gets the writer-schema fingerprint carried by the payload, if available.

public long? WriterFingerprint { get; init; }

Property Value

long?

The CRC-64-AVRO Rabin fingerprint of the writer schema.

Methods

MissingHeader(Type)

Creates a SchemaMismatchException for a payload missing the Avro single-object header.

public static SchemaMismatchException MissingHeader(Type type)

Parameters

type Type

The reader type.

Returns

SchemaMismatchException

A new SchemaMismatchException instance.

Skew(Type, long, long)

Creates a SchemaMismatchException for a writer/reader fingerprint skew.

public static SchemaMismatchException Skew(Type type, long writerFingerprint, long readerFingerprint)

Parameters

type Type

The reader type.

writerFingerprint long

The writer-schema fingerprint from the payload.

readerFingerprint long

The reader-schema fingerprint.

Returns

SchemaMismatchException

A new SchemaMismatchException instance.