Tralys.Analyzers 0.1.0

dotnet add package Tralys.Analyzers --version 0.1.0
                    
NuGet\Install-Package Tralys.Analyzers -Version 0.1.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="Tralys.Analyzers" Version="0.1.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="Tralys.Analyzers" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Tralys.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 Tralys.Analyzers --version 0.1.0
                    
#r "nuget: Tralys.Analyzers, 0.1.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 Tralys.Analyzers@0.1.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=Tralys.Analyzers&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Tralys.Analyzers&version=0.1.0
                    
Install as a Cake Tool

Tralys.Analyzers

Roslyn analyzers for rules that hold in any C# codebase.

<PackageReference Include="Tralys.Analyzers" Version="0.1.0" />

It is a development dependency, so it never reaches the consumers of a package that uses it.

Rules

Rule Severity Reports
TRA0001 Error A null-forgiving operator: x!, null!, default!
TRA0002 Error A [SuppressMessage] naming TRA0001, TRA0003, TRA0004 or TRA0005
TRA0003 Error #nullable disable, a #pragma or .editorconfig severity that silences a nullable warning
TRA0004 Error Nullable not enable, warning level 0, NoWarn/WarningsNotAsErrors for a nullable warning
TRA0005 Error [AllowNull] or [NotNull] on a field or auto-property

The compiler's null checks stay on

! tells the compiler a value is not null without making it so. When that is wrong, the null surfaces as a NullReferenceException somewhere else, and the compiler can no longer point at it. Switching the checks off for a file or a project, or letting a field store a null its reads deny, hides the same thing more widely. Make the code say what is true instead:

  • a non-nullable type, or a required member;
  • [NotNullWhen], [MemberNotNull] and the other nullable attributes on the API that knows;
  • a check where the null can occur: value ?? throw new InvalidOperationException("why it cannot be null").

None of #pragma warning disable, <NoWarn>, an .editorconfig severity or [SuppressMessage] silences these rules, and there is no allowance for existing code: a codebase fixes it before it takes the package.

TRA0005 allows [AllowNull] alongside [MaybeNull], which is an honest nullable, and on storage typed by an open type parameter, such as a pooled slot cleared to default, which C# has no other way to spell.

Generated code is not checked.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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
0.1.0 67 11/23/2026
0.1.0-preview.1 57 11/21/2026