REslava.Result.Analyzers 1.54.0

Prefix Reserved
dotnet add package REslava.Result.Analyzers --version 1.54.0
                    
NuGet\Install-Package REslava.Result.Analyzers -Version 1.54.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="REslava.Result.Analyzers" Version="1.54.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="REslava.Result.Analyzers" Version="1.54.0" />
                    
Directory.Packages.props
<PackageReference Include="REslava.Result.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 REslava.Result.Analyzers --version 1.54.0
                    
#r "nuget: REslava.Result.Analyzers, 1.54.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 REslava.Result.Analyzers@1.54.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=REslava.Result.Analyzers&version=1.54.0
                    
Install as a Cake Addin
#tool nuget:?package=REslava.Result.Analyzers&version=1.54.0
                    
Install as a Cake Tool

REslava.Result.Analyzers

Compile-time safety for Result<T> and OneOf — catch mistakes before they reach production.

Enforces correct usage patterns via Roslyn: RESL10xx series covers API safety (unsafe .Value access, discarded results, missing awaits); RESL20xx series covers domain modeling rules (domain boundary violations, incorrect error types).

NuGet Downloads License

Diagnostics

ID Title Severity Code Fix
RESL1001 Unsafe Result<T>.Value access without IsSuccess check Warning Yes (2 options)
RESL1002 Discarded Result<T> return value Warning --
RESL1003 Prefer Match() over if-check when both branches access .Value/.Errors Info --
RESL1004 Async Task<Result<T>> not awaited Warning Yes
RESL2001 Unsafe OneOf.AsT* access without IsT* check Warning Yes

Examples

var result = GetUser(id);

var user = result.Value;           // Warning RESL1001: Unsafe access without IsSuccess check

DoSomething();                     // Warning RESL1002: Result<T> return value discarded
// (DoSomething returns Result<T> but it's ignored)

if (result.IsSuccess)              // Info RESL1003: Consider using Match()
    Console.Write(result.Value);
else
    Console.Write(result.Errors);

var task = GetUserAsync(id);       // Warning RESL1004: Task<Result<T>> not awaited
// (should be: var result = await GetUserAsync(id);)

var item = oneOf.AsT1;             // Warning RESL2001: Access to '.AsT1' without checking '.IsT1'

Code Fixes

RESL1001 offers two automatic fixes:

// Fix A: Wrap in guard
if (result.IsSuccess) { var user = result.Value; }

// Fix B: Replace with Match
var user = result.Match(v => v, e => default);

RESL1004 adds await:

// Before
var task = GetUserAsync(id);

// After (auto-fixed)
var result = await GetUserAsync(id);

RESL2001 replaces unsafe access with Match:

// Before
var user = oneOf.AsT1;

// After (auto-fixed)
var user = oneOf.Match(t1 => t1, t2 => throw new NotImplementedException());

Quick Start

dotnet add package REslava.Result.Analyzers

That's it. Zero configuration needed. Diagnostics appear in your IDE immediately.

Requires

MIT License | Works with any .NET version (netstandard2.0 analyzer)

There are no supported framework assets in this 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.54.0 108 4/6/2026
1.53.0 117 4/5/2026
1.52.0 105 3/30/2026
1.51.0 135 3/28/2026
1.50.1 102 3/25/2026
1.50.0 99 3/25/2026
1.49.0 101 3/24/2026
1.48.0 99 3/22/2026
1.47.5 99 3/22/2026
1.47.4 97 3/21/2026
1.47.3 97 3/20/2026
1.47.2 96 3/20/2026
1.47.1 99 3/18/2026
1.47.0 96 3/18/2026
1.46.3 101 3/18/2026
1.46.2 101 3/18/2026
1.46.1 93 3/17/2026
1.46.0 96 3/17/2026
1.45.0 98 3/17/2026
1.44.1 96 3/16/2026
Loading failed