Lyo.Diagnostic 2.0.0

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

Lyo.Diagnostic

Decode stack traces, classify exceptions, keep breadcrumb trails, hold an in-memory error inbox, sanitise output, and write structured logs.

Source is grouped by feature folder. Namespaces match, for example StackTrace/ maps to Lyo.Diagnostic.StackTrace. The root Lyo.Diagnostic namespace holds AddDiagnosticsPackage in Registration/. Package metadata DTOs and IPackageMetadataStore live in Lyo.PackageMetadata.

| Folder | Namespace | |-------------------|---------------------------------| | StackTrace/ | Lyo.Diagnostic.StackTrace | | Classification/ | Lyo.Diagnostic.Classification | | Context/ | Lyo.Diagnostic.Context | | Breadcrumbs/ | Lyo.Diagnostic.Breadcrumbs | | Inbox/ | Lyo.Diagnostic.Inbox | | Logging/ | Lyo.Diagnostic.Logging | | Sanitisation/ | Lyo.Diagnostic.Sanitisation | | Registration/ | Lyo.Diagnostic |

Examples

Register in DI

using Lyo.Diagnostic;
using Lyo.Diagnostic.Inbox;

services.AddDiagnosticsPackage();
services.AddInMemoryErrorInbox(o => o.MaxOccurrences = 5_000);

Optional package metadata store (IPackageMetadataStore)

using Lyo.Diagnostic;
using Lyo.PackageMetadata;

var store = new InMemoryPackageMetadataStore();
store.Register(["Npgsql."], new PackageMetadata(
    Guid.Parse("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"),
    PackageEcosystem.NuGet,
    "Npgsql",
    Version: "8.0.0",
    ArtifactDigestAlgorithm.Sha512,
    PackageArtifactDigest.ComputeHexSha512(System.Array.Empty<byte>())));
services.AddDiagnosticsPackage(packageMetadataStore: store);

What ships in the package

  • Stack trace decoding (IStackTraceDecoder). Frames, crash site, fingerprint (stable hash of user-frame method signatures). Optional IPackageMetadataStore from Lyo.PackageMetadata enriches frames with PackageMetadata (Id + Name, …). With a configured store, IDiagnosticContextBuilder.BuildAsync / DecodeAsync perform one bulk metadata resolve for the entire exception/textual inner stack-tree (embedded inner blocks and chained InnerException), not once per subtree. Sync Build / Decode throw when a store is set.
  • Classification (IExceptionClassifier). Severity, kind, labels.
  • Diagnostic context (IDiagnosticContextBuilder). One payload for a single failure.
  • Structured logging (IStructuredLogEnricher). ILogger scopes with diag.* properties.
  • Trace sanitisation (ITraceSanitiser). Redact PII/paths before API responses or logs.
  • Breadcrumbs (RingBufferBreadcrumbTrail, IBreadcrumbTrail). Bounded FIFO trail of short events for triage. Cap per scope, for example an HTTP request.
  • Error inbox (IErrorInboxReader, IErrorOccurrenceSink, InMemoryErrorInbox). Record and query grouped occurrences by fingerprint + exception kind + service. Single-process. Not shared across instances.

Optional package metadata store (IPackageMetadataStore)

Use Lyo.PackageMetadata (InMemoryPackageMetadataStore, or Lyo.PackageMetadata.Postgres). Pass the store as the last argument to AddDiagnosticsPackage, or set StackTraceDecoderOptions.PackageMetadataStore. TryGetManyForStrippedMethodPrefixesAsync resolves many stripped methods at once behind that call. Postgres may cache the ordered prefix catalog in-process. See PostgresPackageMetadataOptions.PrefixCatalogCaching and ClearPrefixCatalogCache. When a store is configured, use BuildAsync and DecodeAsync. Sync Build / Decode throws. Lookup methods expose a namespacePrefix parameter that remains reserved (unused for matching). See IPackageMetadataStore remarks.

For ASP.NET Core (scoped breadcrumbs + automatic recording), use Lyo.Diagnostic.AspNetCore and UseDiagnosticExceptionRecording / AddLyoDiagnosticsWeb.

PII and breadcrumbs

Call IBreadcrumbTrail.Add at meaningful steps (downstream call started, cache miss, etc.). Keep Data and Message values small. Avoid tokens, secrets, full query strings, emails, and raw URLs. Prefer coarse categories and opaque IDs. Optional IBreadcrumbRedactor can strip known keys on each add.

Limits of the in-memory inbox

When over MaxOccurrences, InMemoryErrorInbox drops the oldest occurrences. Data is lost on restart and is not visible across multiple server processes. For durable aggregation, implement IErrorInboxReader / IErrorOccurrenceSink with Postgres or an external product such as Sentry.

Fingerprint

Only user stack-frame method names enter the fingerprint hash — line numbers do not. Minor edits often keep the same key when the defect shape is unchanged. StackTraceDecoder has the details.

  • An inbox on Postgres that implements the same interfaces.
  • HTTP export endpoints for support tooling.
  • A dedicated Serilog enricher package.

Developing

Unit tests live in Lyo.PackageMetadata.Tests and Lyo.Diagnostic.Tests.

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Common.Core (direct, lyo)
  • Lyo.Exceptions (direct, lyo)
  • Lyo.Hashing (direct, lyo)
  • Lyo.PackageMetadata (direct, lyo)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 (direct, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 (direct, microsoft)
  • Lyo.Common.Metadata (transitive, lyo)
  • Microsoft.Bcl.AsyncInterfaces 10.0.5 (transitive, microsoft, netstandard2.0)
  • System.IO.Hashing 10.0.5 (transitive, microsoft, net10.0)
  • System.Memory 4.6.3 (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 (transitive, microsoft, netstandard2.0)
  • System.Threading.Tasks.Extensions 4.6.3 (transitive, microsoft)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Lyo.Diagnostic:

Package Downloads
Lyo.Api.Client

API client library for consuming Lyo APIs.

Lyo.Diagnostic.AspNetCore

ASP.NET Core integration for Lyo.Diagnostic: scoped breadcrumbs, exception recording to the error inbox, and structured logging.

Lyo.Authentication.AspNetCore

ASP.NET Core integration for Lyo.Authentication. Provides an opaque-token authentication handler, a Lyo-JWT authentication handler, and a "LyoBearer" policy scheme that sniffs the credential prefix to dispatch between them. Adds the ScopeAuthorizationPolicyProvider for fine-grained `scope:foo.bar` policies and the `/.well-known/jwks.json` endpoint.

Lyo.Diagnostic.Web.Components

Reusable Blazor components for pasting and analysing .NET stack traces using Lyo.Diagnostic.

Lyo.Authentication.Web.Components.Wasm

Blazor WebAssembly host adapter for `Lyo.Authentication.Web.Components`. Pure-browser token flow: exchanges the API's handoff code in the WASM client, holds the resulting access/refresh tokens in `Blazored.LocalStorage`, and injects the bearer (with auto-refresh) into outbound `HttpClient` calls.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 515 9/9/2026
1.0.13 864 8/25/2026
1.0.11 1,005 8/23/2026
1.0.9 1,223 8/22/2026
1.0.6 1,261 8/20/2026
1.0.4 1,299 8/20/2026
1.0.3 951 8/19/2026
1.0.2 1,019 8/19/2026
1.0.1 972 8/18/2026
1.0.0 847 8/16/2026