Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDK to 8.0 #825

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
image: Visual Studio 2022

environment:
CLI_CHANNEL: 6.0.1xx
CLI_CHANNEL: 8.0

install:
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"version": "8.0.100",
"rollForward" : "latestFeature",
"allowPrerelease": false
}
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="3.11.0" PrivateAssets="all" />
<PackageReference Include="CSharpIsNullAnalyzer" Version="0.1.593" PrivateAssets="all" />
</ItemGroup>
Expand All @@ -31,9 +31,9 @@
<GenerateNullableAttributes>false</GenerateNullableAttributes>
</PropertyGroup>

<!-- Get nullability information from .NET7.0 when compiling for non net7.0 targets -->
<ItemGroup Condition="'$(TargetFramework)' != 'net7.0'">
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[7.0.0]" />
<!-- Get nullability information from .NET8.0 when compiling for non net8.0 targets -->
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[8.0.0]" />
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void OneTimeSetUp()
{
// Find the NetAnalyzers assembly (note version should match the one referenced)
string netAnalyzersPath = Path.Combine(PathHelper.GetNuGetPackageDirectory(),
"microsoft.codeanalysis.netanalyzers/7.0.4/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll");
"microsoft.codeanalysis.netanalyzers/8.0.0/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll");
Assembly netAnalyzerAssembly = Assembly.LoadFrom(netAnalyzersPath);
Type analyzerType = netAnalyzerAssembly.GetType("Microsoft.CodeQuality.CSharp.Analyzers.Maintainability.CSharpAvoidUninstantiatedInternalClasses", true)!;
this.analyzer = (DiagnosticAnalyzer)Activator.CreateInstance(analyzerType)!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public void OneTimeSetUp()
{
// Find the NetAnalyzers assembly (note version should match the one referenced)
string netAnalyzersPath = Path.Combine(PathHelper.GetNuGetPackageDirectory(),
"microsoft.codeanalysis.netanalyzers/7.0.4/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll");
"microsoft.codeanalysis.netanalyzers/8.0.0/analyzers/dotnet/cs/Microsoft.CodeAnalysis.NetAnalyzers.dll");
Assembly netAnalyzerAssembly = Assembly.LoadFrom(netAnalyzersPath);
Type analyzerType = netAnalyzerAssembly.GetType("Microsoft.CodeQuality.CSharp.Analyzers.ApiDesignGuidelines.CSharpTypesThatOwnDisposableFieldsShouldBeDisposableAnalyzer", true)!;
Type analyzerType = netAnalyzerAssembly.GetType("Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.TypesThatOwnDisposableFieldsShouldBeDisposableAnalyzer", true)!;
this.analyzer = (DiagnosticAnalyzer)Activator.CreateInstance(analyzerType)!;

this.analyzer = new DefaultEnabledAnalyzer(this.analyzer);
Expand Down
2 changes: 1 addition & 1 deletion src/nunit.analyzers.tests/nunit.analyzers.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>NUnit.Analyzers.Tests</RootNamespace>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<NUnitVersion Condition="'$(NUnitVersion)'==''">4</NUnitVersion>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override (ExpressionSyntax? actual, ExpressionSyntax? constraintExpres
}
else if (expected is PatternSyntax pattern)
{
constraintExpression = this.ConvertPattern(
constraintExpression = ConvertPattern(
SyntaxFactory.IdentifierName(NUnitFrameworkConstants.NameOfIs),
pattern);
}
Expand Down Expand Up @@ -91,7 +91,7 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G
/// supported-pattern or supported-pattern,
/// supported-pattern and supported-pattern.
/// </remarks>
private InvocationExpressionSyntax? ConvertPattern(ExpressionSyntax member, PatternSyntax pattern)
private static InvocationExpressionSyntax? ConvertPattern(ExpressionSyntax member, PatternSyntax pattern)
{
if (pattern is ConstantPatternSyntax constantPattern)
{
Expand Down Expand Up @@ -125,7 +125,7 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G
}
else if (pattern is UnaryPatternSyntax unaryPattern && unaryPattern.IsKind(SyntaxKind.NotPattern))
{
return this.ConvertPattern(
return ConvertPattern(
SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
member,
Expand All @@ -143,11 +143,11 @@ private static (ExpressionSyntax? actual, ExpressionOrPatternSyntax? expected) G

if (constraint is not null)
{
InvocationExpressionSyntax? leftExpression = this.ConvertPattern(member, binaryPattern.Left);
InvocationExpressionSyntax? leftExpression = ConvertPattern(member, binaryPattern.Left);

if (leftExpression is not null)
{
return this.ConvertPattern(
return ConvertPattern(
SyntaxFactory.MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
leftExpression,
Expand Down
Loading