diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 57792c31..6922a358 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -40,11 +40,11 @@ Note that by contributing to NUnit.Analyzers, you assert that:
## Building the Project
-First, make sure you have the right tools and templates on your machine. You'll need **Visual Studio 2017** or **Visual Studio 2019** and the **.NET Compiler Platform SDK**. The **.NET Compiler Platform SDK** can be installed via the **Visual Studio Installer**. Either
+First, make sure you have the right tools and templates on your machine. You'll need **Visual Studio 2019 version 16.3** (or newer) and the **.NET Compiler Platform SDK**. The **.NET Compiler Platform SDK** can be installed via the **Visual Studio Installer**. Either
* check the **Visual Studio extension development** workload; open the **Visual Studio extension development** node in the summary tree to the right; and check the box for **.NET Compiler Platform SDK** (last under the optional components), or
* select the **Individual components** tab and check the box for **.NET Compiler Platform SDK** (at the top under the Compilers, build tools, and runtimes section).
-The project can now be built from within **Visual Studio 2017** or **Visual Studio 2019**, or by using the **Cake** script in the root folder.
+The project can now be built from within **Visual Studio 2019**, or by using the **Cake** script in the root folder.
### Building using Visual Studio
@@ -53,4 +53,3 @@ From Visual Studio one can debug the analyzers by adding a small test that illus
### Building using Cake
The command `.\build.ps1` will restore the packages necessary to build the solution, build the projects, and then run the tests. The script can also build the projects in **Release** mode using the option `--configuration=Release` or create NuGet Packages using the option `--target=Pack`. This will create a NuGet package under `package\Debug\` (for a `Debug` build) and the file will be named `NUnit.Analyzers.***.nupkg` where `***` depends upon the build type (`Debug` vs. `Release`) and the version. The NuGet package can then be referenced from another project.
-You need to use the `--targetFramework=netstandard1.6` option to build a analyzer version for `netstandard1.6` (VS 2017), this version will not include the new DiagnosticSuppressor rules (NUnit3001-) as these require `netstandard2.0`.
diff --git a/README.md b/README.md
index f1da499f..983d6e72 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ This is a suite of analyzers that target the NUnit testing framework. Right now,
## Download ##
-The latest stable release of the NUnit Analyzers is [available on NuGet](https://www.nuget.org/packages/NUnit.Analyzers/) or can be [downloaded from GitHub](https://github.com/nunit/nunit.analyzers/releases). Note that for Visual Studio 2017 one must use versions below 3.0. Version 3.0 and upwards require Visual Studio 2019, these versions also enables supression of compiler errors such as errors arising from nullable reference types.
+The latest stable release of the NUnit Analyzers is [available on NuGet](https://www.nuget.org/packages/NUnit.Analyzers/) or can be [downloaded from GitHub](https://github.com/nunit/nunit.analyzers/releases). Note that for Visual Studio 2017 one must use versions below 3.0 - note that these versions are no longer updated, so version 2.10.0 is the last version that works in Visual Studio 2017. Version 3.0 and upwards require Visual Studio 2019 (version 16.3) or newer, these versions also enables supression of compiler errors such as errors arising from nullable reference types.
Prerelease nuget packages can be found on [MyGet](https://www.myget.org/feed/nunit-analyzers/package/nuget/NUnit.Analyzers). Please try out the package and report bugs and feature requests.
diff --git a/appveyor.yml b/appveyor.yml
index 2acd8b7b..dd82465d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -14,14 +14,12 @@ before_build:
- cmd: dotnet --version
build_script:
- - ps: .\build.ps1 --target="Appveyor" --configuration="Release" --targetFramework="netstandard1.6"
- ps: .\build.ps1 --target="Appveyor" --configuration="Release" --targetFramework="netstandard2.0"
# disable built-in tests.
test: off
artifacts:
- - path: 'package\Release\netstandard1.6\NUnit.Analyzers*.nupkg'
- path: 'package\Release\netstandard2.0\NUnit.Analyzers*.nupkg'
deploy:
diff --git a/build.cake b/build.cake
index 893a7c74..2e2e7689 100644
--- a/build.cake
+++ b/build.cake
@@ -10,12 +10,7 @@ var targetFramework = Argument("targetFramework", "netstandard2.0");
// SET PACKAGE VERSION
//////////////////////////////////////////////////////////////////////
-var isNetstandard16Build = targetFramework == "netstandard1.6";
-var isNetstandard20Build = targetFramework == "netstandard2.0";
-
-var version = isNetstandard20Build
- ? "4.0.0"
- : "2.11.0";
+var version = "4.0.0";
var isAppveyor = BuildSystem.IsRunningOnAppVeyor;
var dbgSuffix = configuration == "Debug" ? "-dbg" : "";
@@ -59,11 +54,6 @@ Setup(context =>
if (tag.IsTag)
{
var tagName = tag.Name;
- if (isNetstandard16Build && tagName.StartsWith("3"))
- {
- tagName = '2' + tagName.Substring(1);
- }
-
packageVersion = tagName;
packageVersionString = tagName;
}
diff --git a/documentation/index.md b/documentation/index.md
index 1e825729..e27985d6 100644
--- a/documentation/index.md
+++ b/documentation/index.md
@@ -112,7 +112,7 @@ Rules which improve assertions in the test code.
## Suppressor Rules (NUnit3001 - )
Rules which suppress compiler errors based on context. Note that these rules are only available in the .NET Standard 2.0
-builds (version 3.0.0 and above) which require Visual Studio 2019.
+builds (version 3.0.0 and above) which require Visual Studio 2019 (version 16.3) or newer.
| Id | Title | :mag: | :memo: | :bulb: |
| :-- | :-- | :--: | :--: | :--: |
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 446332ee..1b252254 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -5,7 +5,7 @@
NUnit Framework Analyzers
NUnit Project
NUnit Analyzers
- Copyright © 2018-2023 NUnit project
+ Copyright © 2018-2024 NUnit project
diff --git a/src/nunit.analyzers/ConstraintUsage/BaseConditionConstraintAnalyzer.cs b/src/nunit.analyzers/ConstraintUsage/BaseConditionConstraintAnalyzer.cs
index 5ca8ce78..d2126afd 100644
--- a/src/nunit.analyzers/ConstraintUsage/BaseConditionConstraintAnalyzer.cs
+++ b/src/nunit.analyzers/ConstraintUsage/BaseConditionConstraintAnalyzer.cs
@@ -30,11 +30,7 @@ public abstract class BaseConditionConstraintAnalyzer : BaseAssertionAnalyzer
protected static bool IsRefStruct(IOperation operation)
{
-#if NETSTANDARD2_0_OR_GREATER
return operation.Type?.TypeKind == TypeKind.Struct && operation.Type.IsRefLikeType;
-#else
- return false;
-#endif
}
protected static bool IsBinaryOperationNotUsingRefStructOperands(IOperation actual, BinaryOperatorKind binaryOperator)
diff --git a/src/nunit.analyzers/DiagnosticSuppressors/AvoidUninstantiatedInternalClassSuppressor.cs b/src/nunit.analyzers/DiagnosticSuppressors/AvoidUninstantiatedInternalClassSuppressor.cs
index 6f99ac45..d3ff6b2f 100644
--- a/src/nunit.analyzers/DiagnosticSuppressors/AvoidUninstantiatedInternalClassSuppressor.cs
+++ b/src/nunit.analyzers/DiagnosticSuppressors/AvoidUninstantiatedInternalClassSuppressor.cs
@@ -1,5 +1,3 @@
-#if !NETSTANDARD1_6
-
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
@@ -52,5 +50,3 @@ public override void ReportSuppressions(SuppressionAnalysisContext context)
}
}
}
-
-#endif
diff --git a/src/nunit.analyzers/DiagnosticSuppressors/DereferencePossiblyNullReferenceSuppressor.cs b/src/nunit.analyzers/DiagnosticSuppressors/DereferencePossiblyNullReferenceSuppressor.cs
index 6b9b197f..b07f04cf 100644
--- a/src/nunit.analyzers/DiagnosticSuppressors/DereferencePossiblyNullReferenceSuppressor.cs
+++ b/src/nunit.analyzers/DiagnosticSuppressors/DereferencePossiblyNullReferenceSuppressor.cs
@@ -1,5 +1,3 @@
-#if !NETSTANDARD1_6
-
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -464,5 +462,3 @@ private static SuppressionDescriptor CreateSuppressionDescriptor(string suppress
}
}
}
-
-#endif
diff --git a/src/nunit.analyzers/DiagnosticSuppressors/NonNullableFieldOrPropertyIsUninitializedSuppressor.cs b/src/nunit.analyzers/DiagnosticSuppressors/NonNullableFieldOrPropertyIsUninitializedSuppressor.cs
index b5988072..1a9b8724 100644
--- a/src/nunit.analyzers/DiagnosticSuppressors/NonNullableFieldOrPropertyIsUninitializedSuppressor.cs
+++ b/src/nunit.analyzers/DiagnosticSuppressors/NonNullableFieldOrPropertyIsUninitializedSuppressor.cs
@@ -1,5 +1,3 @@
-#if !NETSTANDARD1_6
-
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
@@ -279,5 +277,3 @@ memberAccessExpression.Expression is InvocationExpressionSyntax awaitedInvocatio
}
}
}
-
-#endif
diff --git a/src/nunit.analyzers/DiagnosticSuppressors/TypesThatOwnDisposableFieldsShouldBeDisposableSuppressor.cs b/src/nunit.analyzers/DiagnosticSuppressors/TypesThatOwnDisposableFieldsShouldBeDisposableSuppressor.cs
index 9bbce926..c834b60a 100644
--- a/src/nunit.analyzers/DiagnosticSuppressors/TypesThatOwnDisposableFieldsShouldBeDisposableSuppressor.cs
+++ b/src/nunit.analyzers/DiagnosticSuppressors/TypesThatOwnDisposableFieldsShouldBeDisposableSuppressor.cs
@@ -1,5 +1,3 @@
-#if !NETSTANDARD1_6
-
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis;
@@ -60,5 +58,3 @@ public override void ReportSuppressions(SuppressionAnalysisContext context)
}
}
}
-
-#endif
diff --git a/src/nunit.analyzers/DisposeFieldsAndPropertiesInTearDown/DisposeFieldsAndPropertiesInTearDownAnalyzer.cs b/src/nunit.analyzers/DisposeFieldsAndPropertiesInTearDown/DisposeFieldsAndPropertiesInTearDownAnalyzer.cs
index 068eed30..3be0f389 100644
--- a/src/nunit.analyzers/DisposeFieldsAndPropertiesInTearDown/DisposeFieldsAndPropertiesInTearDownAnalyzer.cs
+++ b/src/nunit.analyzers/DisposeFieldsAndPropertiesInTearDown/DisposeFieldsAndPropertiesInTearDownAnalyzer.cs
@@ -15,9 +15,7 @@ namespace NUnit.Analyzers.DisposeFieldsInTearDown
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public sealed class DisposeFieldsAndPropertiesInTearDownAnalyzer : DiagnosticAnalyzer
{
-#if NETSTANDARD2_0_OR_GREATER
private static readonly char[] AdditionalDisposalMethodsSeparators = { ',', ';', ' ' };
-#endif
// Methods that are considered to be Dispoing an instance.
private static readonly ImmutableHashSet StandardDisposeMethods = ImmutableHashSet.Create(
@@ -143,7 +141,6 @@ private static void AnalyzeDisposableFields(SyntaxNodeAnalysisContext context)
ImmutableHashSet disposeMethods = StandardDisposeMethods;
-#if NETSTANDARD2_0_OR_GREATER
// Are there any additional methods configured that are considered Dispose Methods
// e.g. DisposeIfDisposeable or Release
AnalyzerConfigOptions options = context.Options.AnalyzerConfigOptionsProvider.GetOptions(classDeclaration.SyntaxTree);
@@ -151,7 +148,6 @@ private static void AnalyzeDisposableFields(SyntaxNodeAnalysisContext context)
{
disposeMethods = disposeMethods.Union(value.Split(AdditionalDisposalMethodsSeparators, StringSplitOptions.RemoveEmptyEntries));
}
-#endif
HashSet symbolNames = new(symbols.Keys);
@@ -542,14 +538,12 @@ private static void DisposedIn(Parameters parameters, HashSet disposals,
private static string? GetIdentifier(ExpressionSyntax expression)
{
-#if NETSTANDARD2_0_OR_GREATER
// Account for 'Release(field!)'
if (expression is PostfixUnaryExpressionSyntax postfixUnaryExpression &&
postfixUnaryExpression.IsKind(SyntaxKind.SuppressNullableWarningExpression))
{
expression = postfixUnaryExpression.Operand;
}
-#endif
if (expression is IdentifierNameSyntax identifierName)
{
diff --git a/src/nunit.analyzers/Extensions/AttributeArgumentTypedConstantExtensions.cs b/src/nunit.analyzers/Extensions/AttributeArgumentTypedConstantExtensions.cs
index 57f147be..60d3e035 100644
--- a/src/nunit.analyzers/Extensions/AttributeArgumentTypedConstantExtensions.cs
+++ b/src/nunit.analyzers/Extensions/AttributeArgumentTypedConstantExtensions.cs
@@ -78,17 +78,12 @@ internal static bool CanAssignTo(this TypedConstant @this, ITypeSymbol target, C
if (argumentValue is null)
{
if (
-#if NETSTANDARD1_6
- target.IsReferenceType
-#else
(target.IsReferenceType && (target.NullableAnnotation != NullableAnnotation.NotAnnotated || suppressNullableWarning))
-#endif
|| target.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T)
{
return true;
}
-#if !NETSTANDARD1_6
if (typeParameter is not null)
{
if (typeParameter.HasValueTypeConstraint ||
@@ -101,7 +96,6 @@ internal static bool CanAssignTo(this TypedConstant @this, ITypeSymbol target, C
// Either no constraint or class?
return true;
}
-#endif
}
else
{
diff --git a/src/nunit.analyzers/Extensions/ExpressionSyntaxExtensions.cs b/src/nunit.analyzers/Extensions/ExpressionSyntaxExtensions.cs
index 32911667..905a8e93 100644
--- a/src/nunit.analyzers/Extensions/ExpressionSyntaxExtensions.cs
+++ b/src/nunit.analyzers/Extensions/ExpressionSyntaxExtensions.cs
@@ -51,11 +51,7 @@ internal static class ExpressionSyntaxExtensions
public static bool IsSuppressNullableWarning(this ExpressionSyntax expression)
{
-#if NETSTANDARD1_6
- return false;
-#else
return expression.IsKind(Microsoft.CodeAnalysis.CSharp.SyntaxKind.SuppressNullableWarningExpression);
-#endif
}
}
}
diff --git a/src/nunit.analyzers/Helpers/DiagnosticExtensions.cs b/src/nunit.analyzers/Helpers/DiagnosticExtensions.cs
index d330c844..451afa42 100644
--- a/src/nunit.analyzers/Helpers/DiagnosticExtensions.cs
+++ b/src/nunit.analyzers/Helpers/DiagnosticExtensions.cs
@@ -1,5 +1,3 @@
-#if !NETSTANDARD1_6
-
using System;
using System.Reflection;
using Microsoft.CodeAnalysis;
@@ -16,5 +14,3 @@ public static object[] Arguments(this Diagnostic diagnostic)
}
}
}
-
-#endif
diff --git a/src/nunit.analyzers/SymbolEqualityComparer.cs b/src/nunit.analyzers/SymbolEqualityComparer.cs
deleted file mode 100644
index ddb247b0..00000000
--- a/src/nunit.analyzers/SymbolEqualityComparer.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-#if NETSTANDARD1_6
-using System.Collections.Generic;
-
-namespace Microsoft.CodeAnalysis
-{
- public sealed class SymbolEqualityComparer : IEqualityComparer
- {
- public static readonly SymbolEqualityComparer Default = new();
- public static readonly SymbolEqualityComparer IncludeNullabilty = new();
-
- public bool Equals(ISymbol? x, ISymbol? y)
- {
- if (x is null)
- {
- return y is null;
- }
-
-#pragma warning disable RS1024 // Compare symbols correctly
- return x.Equals(y);
-#pragma warning restore RS1024 // Compare symbols correctly
- }
-
- public int GetHashCode(ISymbol? obj)
- {
-#pragma warning disable RS1024 // Compare symbols correctly
- return obj?.GetHashCode() ?? 0;
-#pragma warning restore RS1024 // Compare symbols correctly
- }
- }
-}
-
-#endif
diff --git a/src/nunit.analyzers/nunit.analyzers.csproj b/src/nunit.analyzers/nunit.analyzers.csproj
index ad673d5d..993785a5 100644
--- a/src/nunit.analyzers/nunit.analyzers.csproj
+++ b/src/nunit.analyzers/nunit.analyzers.csproj
@@ -1,24 +1,17 @@
NUnit.Analyzers
- netstandard2.0;netstandard1.6
+ netstandard2.0
true
true
-
-
-
-
-
-
-
-
+
diff --git a/src/nunit.analyzers/nunit.analyzers.nuspec b/src/nunit.analyzers/nunit.analyzers.nuspec
index 793fef91..4a67de7f 100644
--- a/src/nunit.analyzers/nunit.analyzers.nuspec
+++ b/src/nunit.analyzers/nunit.analyzers.nuspec
@@ -17,10 +17,10 @@
This package includes analyzers and code fixes for test projects using NUnit 3. The analyzers will mark wrong usages when writing tests, and the code fixes can be used to used to correct these usages.
-Version 3.0 and upwards works in Visual Studio 2019 and also enables supression of compiler errors such as errors arising from nullable reference types. For Visual Studio 2017 one must use versions below 3.0.
+Version 3.0 and upwards works in Visual Studio 2019 (version 16.3) or newer and also enables supression of compiler errors such as errors arising from nullable reference types. For Visual Studio 2017 one must use versions below 3.0 - note that these versions are no longer updated, so version 2.10.0 is the last version that works in Visual Studio 2017.
See the release notes on https://github.com/nunit/nunit.analyzers/blob/master/CHANGES.txt.
- Copyright (c) 2018-2023 NUnit project
+ Copyright (c) 2018-2024 NUnit project
nunit, analyzers, roslyn-analyzers