Decode and inspect Protocol Buffer (Protobuf) payloads without .proto files, generated classes or schema definitions.
Microlens.Proto is a schemaless Protobuf inspection toolkit for .NET that automatically intercepts, decodes, visualizes and logs Protobuf traffic across HTTP and gRPC boundaries.
Unlike traditional Protobuf libraries that require compile-time contracts, Microlens.Proto works directly against raw wire-format payloads, making it useful for diagnostics, auditing, reverse engineering and production troubleshooting.
Why Microlens.Proto? | Quick Start | Quick Example | Features | Extensible Architecture | Performance Characteristics | Comparison | When Not To Use Microlens.Proto | Articles | License
Most Protobuf tooling assumes you already have:
.protofiles- generated C# classes
- source-code access
In many real-world scenarios, you have none of those.
Examples of typical use cases:
- Production Diagnostics: Capture payload structures during incident investigation and troubleshooting.
- Debugging
gRPCRequests: inspect request and response messages without modifying service code. - Auditing Binary Traffic: Understand exactly what is crossing service boundaries.
- Reverse Engineering Legacy Systems: Analyze
Protobufpayloads when schemas are unavailable. - API Discovery: Understand third-party
Protobufprotocols without source access. - Understanding Service Behavior: Analyze what a service is actually sending.
dotnet add package Microlens.Protobuilder.Services.AddMicrolensProto();app.UseMicrolensProto();That's it.
HTTP and gRPC payload inspection are automatically enabled.
Given a raw Protobuf payload:
byte[] payload = ...;Microlens.Proto automatically parses raw Protobuf payloads and converts them into a readable tree structure.
├── Field 1 (Varint): 42
├── Field 2 (LengthDelimited): Device-01
├── Field 3 (LengthDelimited)
│ ├── Field 1 (Varint): 123
│ └── Field 2 (LengthDelimited): Active
└── Field 4 (Fixed64): 987654321
- No
.protofiles required. - No schema definitions required.
- No generated classes required.
- No reflection required.
- No custom parsers required.
Microlens.Proto is NOT intended to replace Google.Protobuf or protobuf-net for serialization and deserialization of known contracts.
Instead, it complements them by providing visibility into raw Protobuf traffic.
Decode raw Protobuf wire data without .proto definitions.
Supported wire types:
- Varint
- Fixed32
- Fixed64
- Length Delimited
Automatically detects and recursively decodes embedded Protobuf messages.
Field 5
├── Field 1: HardwareRev
└── Field 2: v3.2
Intercept outbound and inbound Protobuf traffic automatically.
- HttpClient DelegatingHandler
- ASP.NET Core Middleware
Capture and inspect gRPC messages transparently.
- Client Interceptors
- Server Interceptors
Convert binary payloads into readable tree structures.
├── Field 1 (Varint): 999
├── Field 2 (LengthDelimited): Connected
└── Field 3 (Fixed32): 1098488218
Emit structured JSON for:
ElasticsearchSplunkOpenSearchDataDog- Custom analytics pipelines
Built on:
ReadOnlySequence<byte>Span<T>RecyclableMemoryStream
Designed for high-throughput services and production workloads.
Register:
- Custom formatters
- Custom sinks
- Custom telemetry pipelines
The default formatter generates a human-readable tree structure that can be written directly to your existing logging infrastructure.
TimestampUtc = 2026-06-08T12:00:00Z
Channel = Grpc
Direction = Inbound
Phase = Request
Path = /EnvelopeService/Post
Payload:
├── Field 1 (LengthDelimited): HardwareRev
├── Field 2 (LengthDelimited): v3.2
├── Field 3 (Varint): 42
└── Field 4 (Fixed64): 987654321
Microlens.Proto supports custom visualization formats.
public sealed class CompactProtoFormatter : IProtoFormatter {
public ProtoFormatterKey Key => ProtoFormatterKey.Custom;
public string Name => "Compact";
public string Format(IReadOnlyList<ProtoNode> nodes) {
return $"Fields: {nodes.Count}";
}
}builder.Services.AddFormatter<CompactProtoFormatter>("Compact");
builder.Services.AddMicrolensProto(options => {
options.FormatterKey = ProtoFormatterKey.Custom;
options.CustomFormatterName = "Compact";
});Send decoded payload information to any destination.
public sealed class SerilogProtoSink : IProtoSink {
// Custom implementation
}builder.Services.AddSink<SerilogProtoSink>("Serilog");
builder.Services.AddMicrolensProto(options =>
{
options.SinkKey = ProtoSinkKey.Custom;
options.CustomSinkName = "Serilog";
});More Examples:
SeqElasticsearchSplunkOpenSearchDatadogApplication Insights- Custom telemetry platforms
and many more.
Microlens.Proto can inspect both requests and responses across multiple communication channels.
| Channel | Request | Response |
|---|---|---|
| HttpClient | ✓ | ✓ |
| ASP.NET Core Middleware | ✓ | ✓ |
| gRPC Client | ✓ | ✓ |
| gRPC Server | ✓ | ✓ |
Capture and logging behavior can be configured through ProtoOptions.
builder.Services.AddMicrolensProto(options =>
{
options.CaptureMode = ProtoCaptureMode.Both;
options.LogScope = ProtoLogScope.Both;
});Microlens.Proto is designed for production environments and high-throughput workloads.
Key implementation details:
ReadOnlySequence<byte>based parsingSpan<T>friendly processing- Streaming payload inspection
- Buffer pooling through
RecyclableMemoryStream - Recursive nested message decoding
- Minimal allocations where possible
The library is optimized for observability and diagnostics while minimizing runtime overhead.
| Capability | Microlens.Proto |
Traditional Protobuf Libraries |
|---|---|---|
| Serialize known contracts | Yes | Yes |
| Deserialize known contracts | Yes | Yes |
| Schemaless inspection | Yes | Limited |
| Nested message discovery | Yes | Limited |
Works without .proto files |
Yes | No |
| Works without generated classes | Yes | No |
Decode unknown Protobuf payloads |
Yes | No |
HTTP payload interception |
Yes | No |
gRPC payload interception |
Yes | No |
| Logging integration | Yes | No |
| Extensible formatters | Yes | No |
| Extensible sinks | Yes | No |
Microlens.Proto focuses on inspection, diagnostics, observability and traffic analysis rather than contract-based serialization.
Microlens.Proto is not intended for:
- Generating
C#classes from.protofiles - Contract-based serialization
- Contract-based deserialization
- Replacing
Google.Protobuf - Replacing
protobuf-net
If you already have schema definitions and generated types, use a traditional Protobuf library.
Licensed under the Apache License 2.0.
See the LICENSE file for details.