ErrorIntelligence.Core 1.1.1

dotnet add package ErrorIntelligence.Core --version 1.1.1
                    
NuGet\Install-Package ErrorIntelligence.Core -Version 1.1.1
                    
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="ErrorIntelligence.Core" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ErrorIntelligence.Core" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="ErrorIntelligence.Core" />
                    
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 ErrorIntelligence.Core --version 1.1.1
                    
#r "nuget: ErrorIntelligence.Core, 1.1.1"
                    
#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 ErrorIntelligence.Core@1.1.1
                    
#: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=ErrorIntelligence.Core&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=ErrorIntelligence.Core&version=1.1.1
                    
Install as a Cake Tool

Error Intelligence SDK

A .NET SDK that intercepts errors via ILogger and ASP.NET Core middleware, normalizes them into an ErrorEvent, and publishes to a queue. An Orchestrator (Phase 2) consumes the queue and routes to specialized agents that diagnose and attempt to remediate the problem automatically.

Architecture

APPLICATION
   │
   ├── with catch  → logger.LogError(ex, ...) → SDK (ILoggerProvider)
   └── without catch → Middleware → SDK
                            │
                            ▼
                     ErrorEvent (normalized + enriched)
                            │
                            ▼
                   IErrorPublisher (abstraction)
                            │
                            ▼
               Azure Service Bus (queue)
                            │
                            ▼
                      ORCHESTRATOR          ← Phase 2
                            │
              ┌─────────────┼─────────────┐
              ▼             ▼             ▼
          DB Agent     Code Agent    Infra Agent

Core principle: the SDK is dumb — it only captures and publishes. Intelligence lives in the Orchestrator and Agents. The application never breaks if the queue is offline.


Packages

Package Description
ErrorIntelligence.Core Models (ErrorEvent), interfaces (IErrorPublisher), logger provider
ErrorIntelligence.AspNetCore Middleware + DI extensions for ASP.NET Core APIs
ErrorIntelligence.Publisher.ServiceBus Azure Service Bus publisher (Polly retry + circuit breaker)

Installation

Requirements: .NET 8 or higher

dotnet add package ErrorIntelligence.AspNetCore
dotnet add package ErrorIntelligence.Publisher.ServiceBus

Usage

{
  "ErrorIntelligence": {
    "ServiceName": "order-service",
    "Environment": "production",
    "ServiceBus": {
      "FullyQualifiedNamespace": "mynamespace.servicebus.windows.net",
      "QueueOrTopicName": "error-intelligence"
    }
  }
}

For local dev without Managed Identity, replace FullyQualifiedNamespace with ConnectionString.

In Program.cs, just three lines:

builder.Services.AddErrorIntelligence(builder.Configuration);
builder.Services.AddServiceBusErrorPublisher(builder.Configuration);

app.UseErrorIntelligence(); // must come before other middlewares

Setup via code (explicit alternative)

// Managed Identity (production)
builder.Services.AddErrorIntelligence(options =>
{
    options.ServiceName  = "order-service";
    options.Environment  = "production";
});

builder.Services.AddServiceBusErrorPublisher(options =>
{
    options.FullyQualifiedNamespace = "mynamespace.servicebus.windows.net";
    options.QueueOrTopicName        = "error-intelligence";
    // OR for local dev:
    // options.ConnectionString = "Endpoint=sb://...";
});

app.UseErrorIntelligence();

Application code — zero changes required

The SDK works without modifying any existing catch blocks:

// Captured via ILogger
try
{
    await orderService.ProcessAsync(orderId);
}
catch (Exception ex)
{
    logger.LogError(ex, "Error processing order {OrderId}", orderId);
    throw;
}

// Unhandled exceptions are automatically captured by the middleware

ErrorEvent — message contract

Each error published to the queue has the following format:

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "timestamp": "2026-08-28T14:32:00.000Z",
  "service": "order-service",
  "environment": "production",
  "host": "pod-xyz-123",
  "severity": "Error",
  "exceptionType": "System.Data.SqlClient.SqlException",
  "message": "Error processing order 42",
  "stackTrace": "...",
  "innerExceptionType": null,
  "innerExceptionMessage": null,
  "traceId": "00-abc123-def456-00",
  "correlationId": "corr-789",
  "request": {
    "method": "POST",
    "path": "/api/orders",
    "queryString": null,
    "statusCode": null,
    "userAgent": "..."
  },
  "context": {
    "OrderId": "42",
    "UserId": "user-99"
  }
}

Resilience

The Service Bus publisher never breaks the application under any circumstance:

Scenario Behavior
Queue offline / timeout Polly retries (exponential + jitter, default: 3 attempts)
Too many consecutive failures Circuit breaker opens (default: 60s). Event discarded with local LogWarning
Publisher throws exception Caught internally — application continues normally

Resilience configuration

builder.Services.AddServiceBusErrorPublisher(options =>
{
    options.FullyQualifiedNamespace             = "mynamespace.servicebus.windows.net";
    options.QueueOrTopicName                    = "error-intelligence";
    options.MaxRetryAttempts                    = 5;   // default: 3
    options.CircuitBreakerBreakDurationSeconds  = 120; // default: 60
});

Managed Identity

The SDK uses the host application's identity via DefaultAzureCredential. The application — not the SDK — needs the permission.

Required role

Assign Azure Service Bus Data Sender to the application's Managed Identity:

# Get Service Bus namespace resource ID
$sbId = az servicebus namespace show \
  --name mynamespace \
  --resource-group my-rg \
  --query id -o tsv

# Get the Managed Identity principal ID (example: App Service)
$principalId = az webapp identity show \
  --name my-api \
  --resource-group my-rg \
  --query principalId -o tsv

# Assign role on the specific queue (recommended — least privilege)
az role assignment create \
  --assignee $principalId \
  --role "Azure Service Bus Data Sender" \
  --scope "$sbId/queues/error-intelligence"

Local development

az login
az account set --subscription <your-subscription>

DefaultAzureCredential will use your CLI credentials. Alternatively, use ConnectionString in appsettings.Development.json:

{
  "ErrorIntelligence": {
    "ServiceBus": {
      "ConnectionString": "Endpoint=sb://mynamespace.servicebus.windows.net/;SharedAccessKeyName=..."
    }
  }
}

Deduplication

When a catch calls logger.LogError(ex, ...) and then throw, the SDK uses AsyncLocal to mark the error as already published. The middleware detects this flag and skips republishing.

Service throws
   │
   ├── catch → logger.LogError → SDK publishes → [flag: published]
   │
   └── throw → middleware → [flag detected] → SKIP (no duplicate)

Worker Services and Console Apps

For non-HTTP applications, install only Core — no UseErrorIntelligence() needed:

builder.Services.AddErrorIntelligence(options => { ... });
builder.Services.AddServiceBusErrorPublisher(options => { ... });

Publishing

Packages are published to NuGet.org via GitHub Actions using NuGet Trusted Publishing (passwordless OIDC — no API key stored as secret).

How it works

  1. Push a git tag matching v* (e.g. v1.2.3)
  2. GitHub Actions runs build-and-test first
  3. On success, the publish job:
    • Requests an OIDC token from GitHub Actions
    • Exchanges it for a short-lived NuGet API key via NuGet/login@v1
    • Packs all 3 packages with the version extracted from the tag
    • Pushes them to nuget.org
# .github/workflows/publish.yml (simplified)
- name: NuGet login (Trusted Publishing)
  uses: NuGet/login@v1
  id: nuget-login
  with:
    user: AndreMieresNova

- name: Publish to NuGet
  run: |
    dotnet nuget push ./nupkgs/*.nupkg \
      --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" \
      --source https://api.nuget.org/v3/index.json \
      --skip-duplicate

Releasing a new version

git tag v1.2.3
git push origin v1.2.3

That's it — all 3 packages are published automatically with no secrets required.


Running Tests

dotnet test
Passed: 13 / 13

For the project vision and upcoming phases, see ROADMAP.md.

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 was computed.  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 was computed.  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.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ErrorIntelligence.Core:

Package Downloads
ErrorIntelligence.AspNetCore

ASP.NET Core integration for ErrorIntelligence SDK. Provides middleware and DI extensions to capture unhandled exceptions automatically.

ErrorIntelligence.Publisher.ServiceBus

Azure Service Bus publisher for ErrorIntelligence SDK. Publishes ErrorEvents to a Service Bus queue or topic with Polly v8 retry and circuit breaker. Supports Managed Identity and Connection String.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 120 8/28/2026
1.0.3 121 8/28/2026
1.0.2 121 8/28/2026
1.0.1 117 8/28/2026
1.0.0 122 8/28/2026