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
<PackageReference Include="REslava.Result.Analyzers" Version="1.54.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="REslava.Result.Analyzers" Version="1.54.0" />
<PackageReference Include="REslava.Result.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add REslava.Result.Analyzers --version 1.54.0
#r "nuget: REslava.Result.Analyzers, 1.54.0"
#:package REslava.Result.Analyzers@1.54.0
#addin nuget:?package=REslava.Result.Analyzers&version=1.54.0
#tool nuget:?package=REslava.Result.Analyzers&version=1.54.0
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).
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
- REslava.Result (core library)
Links
- GitHub Repository — Full documentation
- Changelog
MIT License | Works with any .NET version (netstandard2.0 analyzer)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- REslava.Result (>= 1.54.0)
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 |