Trellis.Analyzers
3.0.0-alpha.95
This is a prerelease version of Trellis.Analyzers.
dotnet add package Trellis.Analyzers --version 3.0.0-alpha.95
NuGet\Install-Package Trellis.Analyzers -Version 3.0.0-alpha.95
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="Trellis.Analyzers" Version="3.0.0-alpha.95" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trellis.Analyzers" Version="3.0.0-alpha.95" />
<PackageReference Include="Trellis.Analyzers" />
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 Trellis.Analyzers --version 3.0.0-alpha.95
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Trellis.Analyzers, 3.0.0-alpha.95"
#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 Trellis.Analyzers@3.0.0-alpha.95
#: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=Trellis.Analyzers&version=3.0.0-alpha.95&prerelease
#tool nuget:?package=Trellis.Analyzers&version=3.0.0-alpha.95&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Roslyn Analyzers
19 Roslyn analyzers that enforce proper usage of Result<T> and Maybe<T> patterns at compile time — catch unsafe access, unhandled results, and anti-patterns before they reach production.
Installation
dotnet add package Trellis.Analyzers
Analyzers integrate automatically into your build and provide warnings in Visual Studio, VS Code, and dotnet build.
What It Catches
Unsafe Access
// TRLS003: Unsafe Result.Value access
var user = GetUser(id);
Console.WriteLine(user.Value.Name); // May throw
// Fix: Check first, or use Match
if (user.IsSuccess)
Console.WriteLine(user.Value.Name);
Wrong Method Usage
// TRLS002: Map returns Result<Result<T>> — use Bind
var result = userId.Map(id => GetOrder(id)); // Double-wrapped
// Fix: Bind flattens
var result = userId.Bind(id => GetOrder(id)); // Result<Order>
Common Anti-Patterns
// TRLS007: TryCreate().Value — use Create() instead
var email = EmailAddress.TryCreate(input).Value; // Poor error message
// Fix
var email = EmailAddress.Create(input);
All Rules
| Rule | Title | Severity |
|---|---|---|
| TRLS001 | Result return value is not handled | Warning |
| TRLS002 | Use Bind instead of Map when lambda returns Result | Info |
| TRLS003 | Unsafe access to Result.Value | Warning |
| TRLS004 | Unsafe access to Result.Error | Warning |
| TRLS005 | Consider using MatchError for error type discrimination | Info |
| TRLS006 | Unsafe access to Maybe.Value | Warning |
| TRLS007 | Use Create instead of TryCreate().Value | Warning |
| TRLS008 | Result is double-wrapped (Result<Result<T>>) | Warning |
| TRLS009 | Blocking on async Result (.Result or .Wait()) | Warning |
| TRLS010 | Use specific error type instead of base Error | Info |
| TRLS011 | Maybe is double-wrapped (Maybe<Maybe<T>>) | Warning |
| TRLS012 | Consider using Result.Combine | Info |
| TRLS013 | Consider GetValueOrDefault or Match instead of ternary | Info |
| TRLS014 | Use async method variant for async lambda | Warning |
| TRLS015 | Don't throw exceptions in Result chains | Warning |
| TRLS016 | Error message should not be empty | Warning |
| TRLS017 | Don't compare Result or Maybe to null | Warning |
| TRLS018 | Unsafe access to Value in LINQ expression | Warning |
| TRLS019 | Combine chain exceeds maximum tuple size | Error |
Configuration
Suppress or adjust rules using standard .NET mechanisms:
# .editorconfig
[*.cs]
dotnet_diagnostic.TRLS003.severity = suggestion
dotnet_diagnostic.TRLS012.severity = none
Related Packages
- Trellis.Results — Core
Result<T>andMaybe<T>types - Trellis.Asp — ASP.NET Core integration
License
MIT — see LICENSE for details.
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.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 |
|---|---|---|
| 3.0.0-alpha.95 | 0 | 3/2/2026 |
| 3.0.0-alpha.94 | 0 | 3/2/2026 |
| 3.0.0-alpha.93 | 28 | 3/1/2026 |
| 3.0.0-alpha.92 | 45 | 2/28/2026 |
| 3.0.0-alpha.83 | 30 | 2/27/2026 |