UtilityDelta.Honest.Runtime 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package UtilityDelta.Honest.Runtime --version 1.0.0
                    
NuGet\Install-Package UtilityDelta.Honest.Runtime -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="UtilityDelta.Honest.Runtime" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UtilityDelta.Honest.Runtime" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="UtilityDelta.Honest.Runtime" />
                    
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 UtilityDelta.Honest.Runtime --version 1.0.0
                    
#r "nuget: UtilityDelta.Honest.Runtime, 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 UtilityDelta.Honest.Runtime@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=UtilityDelta.Honest.Runtime&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=UtilityDelta.Honest.Runtime&version=1.0.0
                    
Install as a Cake Tool

honest-csharp

C# that behaves like Go, Rust, and Zig: cost and control flow are visible at the call site, nothing hides behind clean syntax. The rules fail the build, not code review.

This is the enforcement for the C# rules in build-method (coding-rules/references/dotnet.md). It does not invent analyzer tech; it bundles the four bans nobody ships and wires the existing analyzers for the rest.

The four custom rules

ID Bans Why
HON001 Properties (and positional-record params) A field cannot hide cost or control flow behind field-access syntax. Public fields only; a computation is a method. Ships a code-fix (property to public readonly field).
HON002 throw Errors are values. Expected failures return Result<T,E>; unrecoverable ones call Panic, which aborts via Environment.FailFast and never throws.
HON003 implicit operator A hidden call on what looks like an assignment. explicit is allowed; the cast is visible.
HON004 dynamic Moves type errors to runtime for no gain.

Reused off the shelf for the rest: Meziantou.Analyzer (MA0053 sealed-by-default), Apex.Analyzers ([Immutable]), ErrorProne.NET, Microsoft.CodeAnalysis.BannedApiAnalyzers (reflection, service-locator).

Run it

./check.sh

Builds the solution (the analyzer breaks the demo build on any violation) and runs the analyzer's own tests. One command, one exit code. That is what CI runs.

Consume it in a repo

Three things, all inherited from Directory.Build.props:

<PackageReference Include="UtilityDelta.Honest.Analyzers" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="UtilityDelta.Honest.Runtime" Version="1.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" PrivateAssets="all" />
<AdditionalFiles Include="BannedSymbols.txt" />

Both packages are on nuget.org: UtilityDelta.Honest.Analyzers, UtilityDelta.Honest.Runtime.

Then escalate to error in .editorconfig (see samples/Demo/.editorconfig):

dotnet_diagnostic.HON001.severity = error
dotnet_diagnostic.HON002.severity = error
dotnet_diagnostic.HON003.severity = error
dotnet_diagnostic.HON004.severity = error
dotnet_diagnostic.CS8509.severity = error

The four rules ship at warning by default so the package is safe to add before a repo is clean; the .editorconfig is what makes them bite.

Auto-fix

dotnet format analyzers

applies the HON001 property-to-field fix across the tree.

Layout

  • AGENTS.md — setup and the build/analyse/fix loop for agents. PRIOR-ART.md — where these rules align with and deliberately invert mainstream .NET.
  • src/Honest.Analyzers — the four rules + the code-fix (netstandard2.0).
  • src/Honest.Runtime — Result<T,E> and Panic.
  • tests/Honest.Analyzers.Tests — a hand-rolled Roslyn harness, no flaky test-framework dependency.
  • samples/Demo — the honest style, building green with every rule at error.

Release

Push a vX.Y.Z tag. CI runs check.sh, packs both packages at that version and pushes them to nuget.org via trusted publishing.

Later

Native union (C# 15 / .NET 11) replaces the Result<T,E> struct and the _ => Panic(...) arm with real closed-set exhaustiveness. Migrate when it reaches GA; do not gate this on the preview SDK.

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.
  • net10.0

    • No dependencies.

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
2.0.0 88 11/8/2026
1.0.1 81 11/8/2026
1.0.0 93 11/8/2026