AvroSharp

A high-performance, Native AOT-friendly .NET implementation of the Apache Avro™ specification: schemas, binary and JSON encoding, schema evolution, source-generated serializers, container files with every codec, single-object encoding and schema-registry framing.

Get started · Code generation · Command-line tool · Kafka and Confluent · Integrations · API reference · Benchmarks · Compared with Apache.Avro · GitHub

Status: stable. The public API follows semantic versioning: no breaking changes before 2.0.

Why AvroSharp

  • Fast: faster than Apache.Avro on every benchmark, and never allocates more: generated records read 3.95× and write 6.18× faster, and container files read up to 22× faster. Benchmarks
  • Generated at build time: a source generator turns .avsc files into C# types with serializers, with no reflection, so they work with Native AOT and trimming. Code generation
  • Complete: Avro 1.12 schemas, binary and JSON encoding, schema resolution, container files with every codec, single-object encoding, canonical forms and fingerprints, and every logical type. Guide
  • Interoperable: the same bytes as Apache.Avro and Apache Avro Java, checked by tests in both directions, with the specification followed where Apache.Avro deviates. Compared with Apache.Avro
  • Safe with untrusted data: bounded memory and nesting for hostile files, messages and schemas, and fuzzed every night. Hostile input
  • Plugs into Kafka: AvroSharp.Confluent gives Confluent.Kafka serializers with Confluent Schema Registry: the same bytes and settings as Confluent's Avro serializer, without Apache.Avro. AvroSharp.KafkaFlow does the same for KafkaFlow, AvroSharp.Azure.SchemaRegistry for Event Hubs and Service Bus with Azure Schema Registry, and AvroSharp.Aws.Glue for AWS Glue Schema Registry. Integrations

Packages

Package What it is Docs
AvroSharp The runtime: schemas (AvroSharp.Schemas), readers and writers (AvroSharp.IO, AvroSharp.Serialization), the generic model (AvroSharp.Generic), container files (AvroSharp.Containers), messages (AvroSharp.Messages) and streams (AvroSharp.Streams) Guide, API
AvroSharp.Generators The source generator: C# types and serializers from .avsc files, and from your own types marked [AvroSerializable], as the project builds Code generation
AvroSharp.Tool avrosharp, the dotnet tool: code generation, canonical forms, fingerprints and compatibility checks from the command line Command-line tool
AvroSharp.Codecs The snappy, zstandard, bzip2 and xz codecs, fully managed Codecs, API
AvroSharp.CodeGen The code generation engine, for your own tools: CSharpCodeGenerator API

Integrations

Add-on packages, built from the same repository and released with AvroSharp at the same version.

Package For Docs
AvroSharp.Confluent Kafka with Confluent Schema Registry: serializers for Confluent.Kafka, the same bytes and settings as Confluent's Avro serializer, without Apache.Avro. Guide, sample, API
AvroSharp.KafkaFlow KafkaFlow producers and consumers, on AvroSharp.Confluent: the same bytes as KafkaFlow's Confluent Avro serializer, and several record types per topic. Guide, sample, API
AvroSharp.Azure.SchemaRegistry Azure Schema Registry with Event Hubs and Service Bus: the message format of Microsoft's Avro serializer, without Apache.Avro. Guide, API
AvroSharp.Aws.Glue AWS Glue Schema Registry, fully managed, on every platform. Guide, API
AvroSharp.Aws.Glue.Kafka Confluent.Kafka serializers for AWS Glue Schema Registry, on AvroSharp.Aws.Glue. Guide, API

Guides

Reference

Apache Avro, Avro and Apache are trademarks of The Apache Software Foundation. AvroSharp is an independent project and is not endorsed by or affiliated with the Apache Software Foundation.