Lyo.Diagnostic 1.0.0

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

Lyo.Diagnostic

Diagnostic utilities: stack trace decoding, exception classification, breadcrumb trails, an in-memory error inbox, sanitisation, and structured logging for observability.

Source is grouped by feature folder; namespaces match (e.g. StackTrace/Lyo.Diagnostic.StackTrace). Lyo.Diagnostic (root) 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

Registering services

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

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

Optional package metadata (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);

Core features

  • 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, DecodeAsync / IDiagnosticContextBuilder.BuildAsync perform one bulk metadata resolve for the entire exception/textual inner stack-tree (embedded inner blocks and chained InnerException), not once per subtree. Sync * Decode* / Build throw when a store is set.
  • Classification (IExceptionClassifier) — kind, severity, labels.
  • Diagnostic context (IDiagnosticContextBuilder) — single payload for one failure.
  • Structured logging (IStructuredLogEnricher) — ILogger scopes with diag.* properties.
  • Trace sanitisation (ITraceSanitiser) — redact paths/PII before logs or API responses.
  • Breadcrumbs (IBreadcrumbTrail, RingBufferBreadcrumbTrail) — bounded FIFO trail of short events for triage (cap per scope, e.g. HTTP request).
  • Error inbox (IErrorOccurrenceSink, IErrorInboxReader, InMemoryErrorInbox) — record and query grouped occurrences by fingerprint + exception kind + service ( single-process; not shared across instances).

Registering services — Optional package metadata (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 *DecodeAsync ** and BuildAsync — sync Decode / Build 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 AddLyoDiagnosticsWeb / UseDiagnosticExceptionRecording.

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

In-memory inbox limits

InMemoryErrorInbox drops oldest occurrences when over MaxOccurrences. Data is lost on restart and is not visible across multiple server processes. For production aggregation, implement IErrorOccurrenceSink / IErrorInboxReader with Postgres or an external product (e.g. Sentry).

Fingerprint

The fingerprint hashes user stack frame method names only (not line numbers), so the same defect shape often keeps the same key across minor edits. See StackTraceDecoder.

  • Postgres-backed inbox implementing the same interfaces.
  • HTTP export endpoints for support tooling.
  • Dedicated Serilog enricher package.

Developing

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

Dependencies

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

  • 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 — (transitive, lyo)
  • 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.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.

Lyo.Diagnostic.Web.Components

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

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 185 8/16/2026