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                
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="Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression" Version="1.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.
paket add Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression --version 1.1.0                
#r "nuget: Pozitron.Analyzers.PrivateConstructorDiagnosticSuppression, 1.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.
// 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">

  NuGet

  Full Build

  Coverage

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.

image

Give a Star! ⭐

If you like or are using this project please give it a star. Thanks!

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
1.1.0 94 9/26/2024
1.0.0 146 3/26/2024

Initial release.