Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression
1.1.0
dotnet add package Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression --version 1.1.0
NuGet\Install-Package Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression -Version 1.1.0
<PackageReference Include="Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression" Version="1.1.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression --version 1.1.0
#r "nuget: Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression, 1.1.0"
// Install Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression as a Cake Addin #addin nuget:?package=Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression&version=1.1.0 // Install Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression as a Cake Tool #tool nuget:?package=Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression&version=1.1.0
<img align="left" src="pozitronlogo.png" width="120" height="120">
Private Constructor Nullability Suppression
A library for suppressing the CS8618 warning for private constructors.
CS8618 - Non-nullable variable must contain a non-null value when exiting constructor. Consider declaring it as nullable.
<strong>Note:</strong> Use it if you're sure the state will be set correctly by other means.
Getting Started
Get it on nuget.org or just include with
<PackageReference Include="Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression" Version="1.0.0" PrivateAssets="All" />
There are no attributes and no configuration. Just include the package and you are good to go.
Motivation
I find the CS8618 compiler warning very useful. But, not rarely, we do define empty private constructors. It's necessary for EF Core, other ORMs, mapping libraries, etc. Once you have that, then this rule becomes an annoyance. You either have to use pragma, or initialize the state to null! which defies the whole purpose.
Give a Star! ⭐
If you like or are using this project please give it a star. Thanks!
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.
Initial release.