AsamMdf

MDF4 File Reader for .NET

Working with MDF4 files has been part of my professional life for years — first deep in embedded systems, wrestling with powerful but complex C++ libraries at the control unit level; later in tooling, relying on the popular Python library asammdf. While asammdf is a fantastic community effort, it was never built for raw performance.

As a .NET developer, I kept looking for a lean, modern NuGet package that would let me process MDF4 files efficiently in my tooling projects. Something that just works — fast, clean, and without friction. It didn’t exist. So I built it.

Over many weekends, driven by real-world experience and genuine passion for the problem. It is designed from the ground up for .NET developers who need reliable, high-performance access to measurement data — without the overhead, without the workarounds.

Features

Comprehensive MDF4 Support

Read channel data with automatic type conversion. Supports all standard data types (integers, floats, strings, byte arrays), VLSD, CANopen Date/Time, Complex Numbers, and MIME data types.

Advanced Conversions

Linear, rational, and algebraic conversions. Lookup tables (value-to-value, value-to-text, text-to-text, text-to-value), partial conversions with value ranges, and automatic unit conversion.

Array Channels (CABLOCK)

Multi-dimensional arrays (maps, curves, classification results). Compact CN template storage, automatic array structure parsing and flattening, ideal for engine calibration maps and sensor matrices.

Performance & Streaming

Streaming API for memory-efficient data access. Support for Deflate and Transpose+Deflate compressed data blocks, lazy loading of channel data, and physical/virtual master channels.

Async API (Async/Await)

Full async/await support for non-blocking operations. Supports CancellationToken for timeouts, ideal for UI applications (WPF/WinForms) and web APIs. All async methods have sync equivalents.

Attachments & Metadata

Extract embedded, compressed, or external attachments with MD5 checksum validation. Access file-level and channel-level metadata including XML comments, units, conversion types, and start time.

Supported Data Types

  • Integer types: byte, sbyte, short, ushort, int, uint, long, ulong (LE & BE)
  • Floating-point: float, double (32/64-bit, LE & BE)
  • Fixed-length strings: SBC/Latin-1, UTF-8, UTF-16 LE/BE
  • Variable-length strings (VLSD)
  • Byte arrays (fixed-length binary data)
  • CANopen Date and Time types
  • Complex Numbers: half/single/double precision, LE/BE (MDF 4.2.0)
  • MIME Sample: embedded binary data with content-type (MDF 4.2.0)
  • MIME Stream: continuous stream of binary samples (MDF 4.2.0)
  • Array channels (CABLOCK): multi-dimensional calibration data
  • Physical master channels (time, angle, distance, index)
  • Virtual master channels (calculated from record index)

Quick Start – Installation

.NET CLI:

dotnet add package AsamMdf --version 0.3.3-beta

Package Manager Console:

NuGet\Install-Package AsamMdf -Version 0.3.3-beta

PackageReference (csproj):

<PackageReference Include="AsamMdf" Version="0.3.3-beta" />

Targets .NET Standard 2.1 – to ensure maximum compatibility from .Net5 to .Net10

Test Coverage

Quality is not an afterthought — it is built into every line of AsamMdf from day one. The MDF4 specification is broad and complex, covering dozens of data types, conversion formulas, compression schemes, and structural edge cases. A library that only works with the files it was developed against is not a library you can rely on in production. That is why we take testing seriously.

More than 200 tests across dedicated sample files. Each feature area has its own set of test files, crafted or sourced to cover the specific scenarios that matter. We do not rely on a single monolithic test file. Instead, every major capability — from integer and floating-point channel reading, to VLSD strings, CANopen types, complex numbers, MIME data, array channels, conversions, compressed data blocks, attachments, and metadata — is validated against dedicated sample files that represent realistic real-world conditions.

Scenario coverage over line coverage. We believe that meaningful test coverage means covering the scenarios that can go wrong — not just the happy path. Our test suite deliberately exercises edge cases: different byte orders (little-endian and big-endian), various signal bit widths, all supported conversion types (linear, rational, algebraic, and all lookup table variants), both physical and virtual master channels, and both embedded and externally referenced attachments. This scenario-first approach gives us confidence that the library behaves correctly across the full breadth of the specification.

~85% code coverage — and growing. Our current automated test suite achieves approximately 85% code coverage, measured against the full implementation. This is a strong foundation, and we are continuously expanding coverage as new features are added and new edge cases are discovered. Every bug report and every new real-world file we encounter is an opportunity to strengthen the test suite further.

The result is a library you can integrate with confidence — knowing that the implementation has been challenged, verified, and proven against a wide range of real MDF4 scenarios.

Licensing & Commercial Use

AsamMdf is currently available as a beta release on NuGet.
The beta version can be used free of charge for evaluation purposes and supports MDF files up to 50 MB in size. This allows you to thoroughly test the library within your development and validation workflows before making a purchasing decision.

If AsamMdf meets your technical and project requirements, we kindly invite you to acquire a commercial license. A commercial license removes the file size limitation.

As we are a small and specialized company, we appreciate your understanding that we do not yet provide a fully automated online booking or licensing system. Instead, we prefer to offer personalized licensing options tailored to your specific use case, team size, and deployment scenario. This ensures that you receive a fair and flexible offer that fits your needs.

For licensing inquiries or any questions regarding commercial usage, please contact us directly at

We are happy to discuss your requirements and provide a customized proposal.