TA.Analyzers.InvalidNullChecks 1.0.0

dotnet add package TA.Analyzers.InvalidNullChecks --version 1.0.0
NuGet\Install-Package TA.Analyzers.InvalidNullChecks -Version 1.0.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="TA.Analyzers.InvalidNullChecks" Version="1.0.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 TA.Analyzers.InvalidNullChecks --version 1.0.0
#r "nuget: TA.Analyzers.InvalidNullChecks, 1.0.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 TA.Analyzers.InvalidNullChecks as a Cake Addin
#addin nuget:?package=TA.Analyzers.InvalidNullChecks&version=1.0.0

// Install TA.Analyzers.InvalidNullChecks as a Cake Tool
#tool nuget:?package=TA.Analyzers.InvalidNullChecks&version=1.0.0

Reduce bugs by finding unneeded null checks and suppressions of known not-null values.

namespace InvalidNullChecksTest
{
	internal class Program
	{
		static void Main(string[] args)
		{
			if (_s1 == null) return;
			if (_s2 == null) return;
			if (_s2 is null) return;

			_s2 ??= "def";

			if (_s3 is not null)
			{
				if (_s3 is null) return;
				if (_s3 == null) return;
			}

			if (_s3 != null)
			{
				if (_s3 is null) return;
				if (_s3 == null) return;
			}

			string r1 = _s1!.Trim();
			string r2 = _s2!.Trim();
		}
		static string? _s1;
		static string _s2 = "abc";
		static string? _s3;
	}
}

Resulting warnings

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
1.0.0 285 3/18/2024