PowerCSharp.Operational 1.0.1

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

PowerCSharp.Operational

PowerCSharp Banner

Cross-cutting issue capture, in-app diagnostics, structured logging, disk event-log writing, and HTTP retry/circuit-breaker resilience for ASP.NET Core applications — safe to enable or disable at any time.

Pair this package with PowerCSharp.Operational.Abstractions (contracts + NoOp) for the cross-platform contract surface.

Contents

  • DiagnosticsService — per-request diagnostics: trace/breadcrumb/exception/error capture, activated via HTTP headers (debug, debugVerbose, traceLevel, eventLog, cacheDisabled, performance — see DiagnosticHeaders), with sensitive-data masking delegated to PowerCSharp.Feature.Sanitization.Abstractions.
  • IssueManager — centralized exception/error/breadcrumb capture, forwarding to IDiagnosticsService.
  • DiagnosticsLogger / DiagnosticsLoggerProvider — a custom ILogger that forwards to diagnostics and (optionally) a platform event log.
  • EventLogWriter / EventLogRetentionCleaner — background NDJSON disk writer with cross-process file locking, and a companion retention-cleanup sweep.
  • RetryPolicyProvider — Polly-based retry + circuit breaker for outbound HTTP calls, using decorrelated jitter backoff.
  • OperationalServiceCollectionExtensionsAddOperational() / UseOperational() explicit DI wiring.
  • OperationalFeatureModule — optional PowerCSharp.Features auto-discovery module.

Usage

// Program.cs
builder.Services.AddOperational(builder.Configuration);

var app = builder.Build();
app.UseOperational();
// appsettings.json
{
  "PowerFeatures": {
    "Operational": {
      "Enabled": true,
      "LogsBasePath": "C:\\Logs",
      "LogsRetentionDays": 30
    }
  }
}

Then, from anywhere with constructor access to IIssueManager / IDiagnosticsService:

public class SomeService(IIssueManager issueManager, IDiagnosticsService diagnostics)
{
    public async Task DoWorkAsync()
    {
        try
        {
            diagnostics.AddBreadcrumb("Starting work", category: "SomeService");
            // ...
        }
        catch (Exception ex)
        {
            issueManager.CaptureException(ex);
            throw;
        }
    }
}

Optional: Features Framework integration

builder.Services.AddPowerFeatures(builder.Configuration, options =>
{
    options.ScanAssemblies(typeof(OperationalFeatureModule).Assembly);
});

Design notes

  • No static service locator. Unlike the source implementation this package was built from, IDiagnosticsService and IIssueManager are constructor-injected. The one deliberate exception is DiagnosticsLogger, which resolves IDiagnosticsService from HttpContext.RequestServices at each log call — the standard, narrowly-scoped pattern for bridging a singleton-lifetime ILogger to per-request scoped services, not a general-purpose locator.
  • EventLogWriter is a DI singleton, not a hand-rolled static Instance — every dependency it needs is itself singleton-safe.
  • Correlation id is a known v1 gap, marked with // TODO at each call site. No PowerCSharp correlation-id abstraction exists yet; this is tracked for a future phase rather than silently dropped or half-ported from a Sentry-coupled origin.
  • No Windows Event Log code lives in this package. IEventViewerService defaults to NoOpEventViewerService; a future PowerCSharp.Operational.WinEventLog provider package supplies the real Windows implementation. See docs/PowerCSharp.Operational.Architecture.md.

Details

  • Package ID: PowerCSharp.Operational
  • Depends on: PowerCSharp.Operational.Abstractions, PowerCSharp.Features.Abstractions, PowerCSharp.Feature.Sanitization.Abstractions, Polly
  • Target framework: net8.0 (requires an ASP.NET Core host)
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

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.0.1 33 8/25/2026