From 8f07cca85099768af4cb7a4ae2485d7409c1cf76 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 16 Dec 2022 11:48:43 +0200 Subject: [PATCH 1/2] Move tests to target .NET 7 --- .../UnitTests/Microsoft.CodeAnalysis.Analyzers.UnitTests.csproj | 2 +- .../Microsoft.CodeAnalysis.BannedApiAnalyzers.UnitTests.csproj | 2 +- .../Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj | 2 +- .../Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj | 2 +- ....CodeAnalysis.PerformanceSensitiveAnalyzers.UnitTests.csproj | 2 +- .../Microsoft.CodeAnalysis.PublicApiAnalyzers.UnitTests.csproj | 2 +- .../UnitTests/Roslyn.Diagnostics.Analyzers.UnitTests.csproj | 2 +- src/Test.Utilities/Test.Utilities.csproj | 2 +- src/Text.Analyzers/UnitTests/Text.Analyzers.UnitTests.csproj | 2 +- .../Tests/RulesetToEditorconfigConverter.UnitTests.csproj | 2 +- src/Utilities.UnitTests/Analyzer.Utilities.UnitTests.csproj | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.CodeAnalysis.Analyzers/UnitTests/Microsoft.CodeAnalysis.Analyzers.UnitTests.csproj b/src/Microsoft.CodeAnalysis.Analyzers/UnitTests/Microsoft.CodeAnalysis.Analyzers.UnitTests.csproj index 520f648971..e9aa072f21 100644 --- a/src/Microsoft.CodeAnalysis.Analyzers/UnitTests/Microsoft.CodeAnalysis.Analyzers.UnitTests.csproj +++ b/src/Microsoft.CodeAnalysis.Analyzers/UnitTests/Microsoft.CodeAnalysis.Analyzers.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true diff --git a/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/UnitTests/Microsoft.CodeAnalysis.BannedApiAnalyzers.UnitTests.csproj b/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/UnitTests/Microsoft.CodeAnalysis.BannedApiAnalyzers.UnitTests.csproj index c895762b1f..f2de756904 100644 --- a/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/UnitTests/Microsoft.CodeAnalysis.BannedApiAnalyzers.UnitTests.csproj +++ b/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/UnitTests/Microsoft.CodeAnalysis.BannedApiAnalyzers.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true diff --git a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj index cb2c93b99b..9b276b0114 100644 --- a/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj +++ b/src/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net7.0 true true diff --git a/src/NetAnalyzers/UnitTests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj b/src/NetAnalyzers/UnitTests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj index 058b1699e5..cc2bd50728 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj +++ b/src/NetAnalyzers/UnitTests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 $(DefineConstants),NET_ANALYZERS_TEST true diff --git a/src/PerformanceSensitiveAnalyzers/UnitTests/Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers.UnitTests.csproj b/src/PerformanceSensitiveAnalyzers/UnitTests/Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers.UnitTests.csproj index 660e704e55..09891feafc 100644 --- a/src/PerformanceSensitiveAnalyzers/UnitTests/Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers.UnitTests.csproj +++ b/src/PerformanceSensitiveAnalyzers/UnitTests/Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true $(NoWarn);xUnit1000;CA1812 diff --git a/src/PublicApiAnalyzers/UnitTests/Microsoft.CodeAnalysis.PublicApiAnalyzers.UnitTests.csproj b/src/PublicApiAnalyzers/UnitTests/Microsoft.CodeAnalysis.PublicApiAnalyzers.UnitTests.csproj index 2d213aa4db..3d8bc7ee1e 100644 --- a/src/PublicApiAnalyzers/UnitTests/Microsoft.CodeAnalysis.PublicApiAnalyzers.UnitTests.csproj +++ b/src/PublicApiAnalyzers/UnitTests/Microsoft.CodeAnalysis.PublicApiAnalyzers.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true diff --git a/src/Roslyn.Diagnostics.Analyzers/UnitTests/Roslyn.Diagnostics.Analyzers.UnitTests.csproj b/src/Roslyn.Diagnostics.Analyzers/UnitTests/Roslyn.Diagnostics.Analyzers.UnitTests.csproj index 38ea8f8320..b0537d0b13 100644 --- a/src/Roslyn.Diagnostics.Analyzers/UnitTests/Roslyn.Diagnostics.Analyzers.UnitTests.csproj +++ b/src/Roslyn.Diagnostics.Analyzers/UnitTests/Roslyn.Diagnostics.Analyzers.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true diff --git a/src/Test.Utilities/Test.Utilities.csproj b/src/Test.Utilities/Test.Utilities.csproj index 0540d0d09c..24bf9a467d 100644 --- a/src/Test.Utilities/Test.Utilities.csproj +++ b/src/Test.Utilities/Test.Utilities.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true true diff --git a/src/Text.Analyzers/UnitTests/Text.Analyzers.UnitTests.csproj b/src/Text.Analyzers/UnitTests/Text.Analyzers.UnitTests.csproj index 1d3a690632..ca733e0b57 100644 --- a/src/Text.Analyzers/UnitTests/Text.Analyzers.UnitTests.csproj +++ b/src/Text.Analyzers/UnitTests/Text.Analyzers.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true diff --git a/src/Tools/RulesetToEditorconfigConverter/Tests/RulesetToEditorconfigConverter.UnitTests.csproj b/src/Tools/RulesetToEditorconfigConverter/Tests/RulesetToEditorconfigConverter.UnitTests.csproj index 51f132d138..1cfbacd3d1 100644 --- a/src/Tools/RulesetToEditorconfigConverter/Tests/RulesetToEditorconfigConverter.UnitTests.csproj +++ b/src/Tools/RulesetToEditorconfigConverter/Tests/RulesetToEditorconfigConverter.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true false true diff --git a/src/Utilities.UnitTests/Analyzer.Utilities.UnitTests.csproj b/src/Utilities.UnitTests/Analyzer.Utilities.UnitTests.csproj index baddd5d66c..14f5c9118e 100644 --- a/src/Utilities.UnitTests/Analyzer.Utilities.UnitTests.csproj +++ b/src/Utilities.UnitTests/Analyzer.Utilities.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net472 + net7.0 true true true From 8681ec1cf4957a48c0c901c8cc57b65292df5b16 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 16 Dec 2022 12:07:40 +0200 Subject: [PATCH 2/2] Fix nullability warnings --- .../Lightup/IFunctionPointerInvocationOperationWrapper.cs | 2 +- src/Utilities/Compiler/Lightup/LightupHelpers.cs | 2 +- src/Utilities/Compiler/RulesetToEditorconfigConverter.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Utilities/Compiler/Lightup/IFunctionPointerInvocationOperationWrapper.cs b/src/Utilities/Compiler/Lightup/IFunctionPointerInvocationOperationWrapper.cs index 56ec582cd1..f5ae9d2878 100644 --- a/src/Utilities/Compiler/Lightup/IFunctionPointerInvocationOperationWrapper.cs +++ b/src/Utilities/Compiler/Lightup/IFunctionPointerInvocationOperationWrapper.cs @@ -39,7 +39,7 @@ private static Func CreateFunctionPointerSignatureAcc var operation = Expression.Variable(typeof(IOperation)); - return Expression.Lambda>(Expression.Call(targetMethod, Expression.Convert(operation, WrappedType)), operation).Compile(); + return Expression.Lambda>(Expression.Call(targetMethod, Expression.Convert(operation, wrappedType)), operation).Compile(); } private IFunctionPointerInvocationOperationWrapper(IOperation operation) diff --git a/src/Utilities/Compiler/Lightup/LightupHelpers.cs b/src/Utilities/Compiler/Lightup/LightupHelpers.cs index 8ba9e1d286..39b63ec4ad 100644 --- a/src/Utilities/Compiler/Lightup/LightupHelpers.cs +++ b/src/Utilities/Compiler/Lightup/LightupHelpers.cs @@ -66,7 +66,7 @@ private static Func CreatePropertyAccessor(Type? typ ? parameter : Expression.Convert(parameter, type); - Expression result = Expression.Call(instance, property.GetMethod); + Expression result = Expression.Call(instance, property.GetMethod!); if (!typeof(TProperty).GetTypeInfo().IsAssignableFrom(property.PropertyType.GetTypeInfo())) { result = Expression.Convert(result, typeof(TProperty)); diff --git a/src/Utilities/Compiler/RulesetToEditorconfigConverter.cs b/src/Utilities/Compiler/RulesetToEditorconfigConverter.cs index 0cddc4c781..626c4f6c4d 100644 --- a/src/Utilities/Compiler/RulesetToEditorconfigConverter.cs +++ b/src/Utilities/Compiler/RulesetToEditorconfigConverter.cs @@ -96,7 +96,7 @@ static XElement GetTopLevelRulesetNode(string rulesetFilePath) var ruleSetDocument = XDocument.Load(xmlReader); // Find the top level rule set node - var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).FirstOrDefault(); + var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); Debug.Assert(rulesetNode.Name == RuleSetNodeName); return rulesetNode; } @@ -143,7 +143,7 @@ static void PopulateRuleIdToComments(string rulesetFilePath, Dictionary())