CoreSystem.Correlation 1.1.0

dotnet add package CoreSystem.Correlation --version 1.1.0
                    
NuGet\Install-Package CoreSystem.Correlation -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoreSystem.Correlation" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreSystem.Correlation" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CoreSystem.Correlation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CoreSystem.Correlation --version 1.1.0
                    
#r "nuget: CoreSystem.Correlation, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CoreSystem.Correlation@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CoreSystem.Correlation&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CoreSystem.Correlation&version=1.1.0
                    
Install as a Cake Tool

⚡ CoreSystem.Correlation

Correlation ID propagation middleware for ASP.NET Core.

CoreSystem.Correlation is a lightweight, standalone library that accepts or issues a correlation identifier per request, exposes it via HttpContext.Items, and enriches log scopes with it. It can also be composed with CoreSystem.Observability.

NuGet Downloads License .NET


✨ Features

  • ✅ Accepts a client-provided correlation header (configurable name)
  • ✅ Generates a reliable Guid-based ID otherwise
  • ✅ Exposes the ID via HttpContext.Items[CoreCorrelationConstants.HttpContextItemKey]
  • ✅ Echoes the ID back in the response headers
  • ✅ Enriches log scopes with a correlationId property
  • ✅ Input validation (length + character allowlist)
  • ✅ IOptions/IConfiguration binding
  • ✅ Standalone — no dependency on CoreSystem.Observability

📦 Installation

dotnet add package CoreSystem.Correlation

🚀 Quick Start

Register the services:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddCoreCorrelation(); // or builder.Services.AddCoreCorrelation(o => o.MaximumLength = 64);

var app = builder.Build();

Add the middleware:

app.UseCoreCorrelationId(); // after UseRouting/UseCors, before endpoints

Read the current ID anywhere in the pipeline:

app.MapGet("/ping", (HttpContext ctx) =>
    Results.Ok(ctx.Items[CoreCorrelationConstants.HttpContextItemKey]));

⚙ Configuration

Bind from the Core:Correlation configuration section:

builder.Services.AddCoreCorrelation(builder.Configuration);
Property Default Description
Enabled true Enables correlation propagation
HeaderName X-Correlation-Id Header read from (and written back to) the request
IncludeInResponse true Whether the ID is echoed in the response
MaximumLength 128 Maximum accepted length for a client-provided ID

🏗 Architecture

Client Request
     │
     ▼
CorrelationIdMiddleware
     │
     ├── validates / generates id
     ├── context.Items["CoreSystem.CorrelationId"]
     ├── logger scope (correlationId)
     ▼
Request pipeline

Each request gets one ID for its whole pipeline. The value flows through HttpContext.Items and log scopes so application code can attach it to logs and downstream calls without HTTP-specific knowledge.


📖 Documentation

The full documentation includes:

  • Getting Started
  • Configuration
  • Log enrichment
  • Composing with CoreSystem.Observability
  • Architecture

Visit the GitHub repository for the complete documentation.


🤝 Contributing

Issues, discussions and pull requests are welcome.


📄 License

Released under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 104 10/19/2026
1.0.0 83 10/7/2026

1.1.0: targets net8.0, net9.0 and net10.0. No public API or behavior change; the net9.0 and net10.0 assets are new, and the net8.0 asset is unchanged.