
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
.avscfiles 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
- Getting started: installing, a first program, and a page per task, each built from a runnable sample.
- First steps: parse a schema, write and read values, read an older version of the data, JSON (
AvroSharp.Schemas,AvroSharp.Generic). - Object container files: writing and reading
.avrofiles, synchronously and asynchronously, with any codec (AvroSharp.Containers,AvroSharp.Codecs). - Single-object encoding and schema registries: messages that carry their schema's fingerprint or ID, with Confluent, Apicurio and AWS Glue framing (
AvroSharp.Messages). - Streams of objects: objects one after another, for sockets and pipes (
AvroSharp.Streams). - Integrations: message brokers and schema registries, AvroSharp.Confluent for Confluent.Kafka, AvroSharp.KafkaFlow for KafkaFlow, AvroSharp.Azure.SchemaRegistry for Azure Schema Registry, and AvroSharp.Aws.Glue for AWS Glue Schema Registry.
- Kafka and Confluent Schema Registry: AvroSharp.Confluent's serializers for Confluent.Kafka, their settings, and moving from Confluent's Avro serializer and from Chr.Avro.
- KafkaFlow: AvroSharp.KafkaFlow's serializer middleware, several record types per topic, and moving from KafkaFlow's Confluent Avro serializer.
- Azure Schema Registry: AvroSharp.Azure.SchemaRegistry's serializer for Event Hubs and Service Bus, and moving from Microsoft's Avro serializer.
- AWS Glue Schema Registry: AvroSharp.Aws.Glue's managed serializer for Kafka and Kinesis, and moving from AWS's native serializer.
- Code generation: the source generator, its MSBuild properties, type mapping, schema evolution, and moving from avrogen.
- The avrosharp tool:
gen,schema canonical,schema fingerprintandschema compat, exit codes, and use in CI. - Samples: runnable programs for the main APIs.
Reference
- API reference: every public type, from the XML documentation, by namespace:
AvroSharp,AvroSharp.Schemas,AvroSharp.Generic,AvroSharp.IO,AvroSharp.Serialization,AvroSharp.Containers,AvroSharp.Codecs,AvroSharp.Messages,AvroSharp.Streams,AvroSharp.CodeGen,AvroSharp.Confluent,AvroSharp.KafkaFlow,AvroSharp.Azure.SchemaRegistry,AvroSharp.Aws.GlueandAvroSharp.Aws.Glue.Kafka. - Benchmarks: the results against Apache.Avro, what is measured, and how to run it.
- AvroSharp and Apache.Avro: what differs, when to use which, and how to migrate.
- Design: the design and the decisions made since.
- Roadmap: what is done and what comes next.
- Documentation index: all pages, and the dated benchmark and review notes.
- Changelog, contributing, security policy.
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.