DcsvIo.D2.Utilities 0.1.1

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

DcsvIo.D2.Utilities

Foundational helpers used at every boundary across D2. The "no value too small to centralize" library — preventing whole classes of bugs (empty-string-as-data, env-var collisions, JSON cycles) from ever entering domain code.

Runtime dependencies are kept minimal so this lib stays domain-safe:

  • dotenv.net — only loaded when D2Env.Load() is called
  • JetBrains.Annotations — compile-time markers
  • DcsvIo.D2.Result + DcsvIo.D2.I18n.Abstractions — both zero-runtime-dep themselves; pulled in so TryParseEmail / TryParsePhoneNumber can return D2Result<string> with TK.*-keyed messages

Install

dotnet add package DcsvIo.D2.Utilities

Public API (by concern)

Concern Covers
Attributes [RedactData] marker attribute consumed by the Serilog destructuring policy.
Configuration ConnectionStringHelper (URI ↔ wire-format conversion for Redis / Postgres / RabbitMQ) + D2Env (host-side .env* file loader).
Diagnostics SanitizedExceptionRender — PII-safe exception rendering for log + telemetry + DLQ-header surfaces.
Enums IsolationLevel (SQL transaction isolation taxonomy) + RedactReason (closed enum used by [RedactData]).
Extensions The most-used surface: Truthy() / Falsey() / ToNullIfEmpty() boundary checks; ThrowIfFalsey() required-argument guards (BCL-split null vs falsey); TryParseTruthyNull Guid + enum parsers; CleanStr / CleanDisplayStr display cleaners; TryParseEmail / TryParsePhoneNumber D2Result-returning validators; GetNormalizedStrForHashing; NormalizeForHash (single-value cross-script hash canonicalization); Clean() for enumerables.
Serialization SerializerOptions — frozen JsonSerializerOptions presets (SR_IgnoreCycles, SR_Web, SR_WebIgnoreNull).

Adversarial coverage notes

Public surfaces are covered adversarially across every boundary helper, including:

  • All Truthy/Falsey overloads — null, empty, whitespace-only, multi-element, boundary values.
  • ToNullIfEmpty — null/empty/whitespace/trim/identity paths.
  • CleanStr / CleanDisplayStr — Unicode multi-script preservation, allowed-char retention, all-stripped → null.
  • TryParseEmail / TryParsePhoneNumber — happy paths + documented failure conditions; asserts D2Result.IsValidationFailed and the carried TK.Common.Validation.EMAIL_INVALID / PHONE_INVALID key.
  • GuidExtensions.TryParseTruthyNull / EnumExtensions.TryParseTruthyNull<TEnum> — happy path + adversarial coverage.
  • GetNormalizedStrForHashing / NormalizeForHash — empty, multi-script, idempotency, determinism.
  • EnumerableExtensions.Clean — empty-behavior × value-null-behavior matrix.
  • RedactDataAttribute — defaults, init-only setters, reflective discovery.
  • SerializerOptions — camelCase, string-enums, null preservation/omission, cycle tolerance.
  • ConnectionStringHelper / D2Env — URI conversion, env-var resolution, discovery precedence.
  • SanitizedExceptionRender — type-name fallback, first-frame format, anti-leak invariants (rendered strings never contain Exception.Message).
Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (24)

Showing the top 5 NuGet packages that depend on DcsvIo.D2.Utilities:

Package Downloads
DcsvIo.D2.Auth.Abstractions

Identity and authorization vocabulary plus consumer-side runtime contracts for D2 inbound auth — value types, constants, and read-only interfaces.

DcsvIo.D2.Time

Deterministic timestamp handling for D2 — a dependency-injected clock seam, temporal storage types, and NodaTime to PostgreSQL EF Core wiring.

DcsvIo.D2.AuthContext.Abstractions

Read-only IAuthContext interface for reasoning about caller identity, organization, scopes, and impersonation context in D2.

DcsvIo.D2.Context.Abstractions

Spec-driven request-context primitives for D2 — IRequestContext, MutableRequestContext, and the cross-hop propagation codecs.

DcsvIo.D2.Geo.Abstractions

Strongly-typed ISO geo reference-data type surface for D2 (countries, subdivisions, currencies, languages, locales, timezones) without catalog data.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 416 7/17/2026
0.1.0 424 7/17/2026