diff --git a/eng/build.ps1 b/eng/build.ps1 index f81ad5b3afd899187e3a0cdf74f3dbe3c87e2662..ee79989b58ba2f379fb8da8c30d6550b6e714e85 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -212,7 +212,7 @@ function BuildSolution() { $projects = Join-Path $RepoRoot $solution $toolsetBuildProj = InitializeToolset - $testTargetFrameworks = if ($testCoreClr) { "netcoreapp3.1" } else { "" } + $testTargetFrameworks = if ($testCoreClr) { 'net5.0%3Bnetcoreapp3.1' } else { "" } $ibcDropName = GetIbcDropName @@ -406,6 +406,7 @@ function TestUsingOptimizedRunner() { # Exclude out the multi-targetted netcore app projects $dlls = $dlls | ?{ -not ($_.FullName -match ".*netcoreapp.*") } + $dlls = $dlls | ?{ -not ($_.FullName -match ".*net5.0.*") } # Exclude out the ref assemblies $dlls = $dlls | ?{ -not ($_.FullName -match ".*\\ref\\.*") } diff --git a/eng/build.sh b/eng/build.sh index 3dfb1abe19534c6f79e35df3e3fd8e78abbd8691..30a6fbd1f8e24eafc000ccbbfc5c19d452c1fc1d 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -266,7 +266,7 @@ function BuildSolution { test_runtime_args="--debug" elif [[ "$test_core_clr" == true ]]; then test=true - test_runtime="/p:TestRuntime=Core /p:TestTargetFrameworks=netcoreapp3.1" + test_runtime="/p:TestRuntime=Core /p:TestTargetFrameworks=net5.0%3Bnetcoreapp3.1" mono_tool="" fi diff --git a/eng/targets/Settings.props b/eng/targets/Settings.props index 229d6f3a93c1828c533ea1b866d29307982a448d..f17b08fdc703c00aed45cbebae24ff9a6ff2405d 100644 --- a/eng/targets/Settings.props +++ b/eng/targets/Settings.props @@ -65,7 +65,7 @@ These may be overridden by projects that need to be skipped. --> net46;net472 - netcoreapp3.1 + netcoreapp3.1;net5.0 $(MSBuildThisFileDirectory)..\config\xunit.runner.json $(MSBuildThisFileDirectory)..\config\xunit.runner.json diff --git a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs index c857d2344fe5353f0e8556334d709495df031996..37cc427d8de2691016e070e78ddcd67d8ef7df2a 100644 --- a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs +++ b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs @@ -40,7 +40,7 @@ namespace Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests { public class CommandLineTests : CommandLineTestBase { -#if NETCOREAPP3_1 +#if NETCOREAPP private static readonly string s_CSharpCompilerExecutable; private static readonly string s_DotnetCscRun; #else @@ -55,7 +55,7 @@ public class CommandLineTests : CommandLineTestBase static CommandLineTests() { -#if NETCOREAPP3_1 +#if NETCOREAPP var cscDllPath = Path.Combine( Path.GetDirectoryName(typeof(CommandLineTests).GetTypeInfo().Assembly.Location), Path.Combine("dependency", "csc.dll")); diff --git a/src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj b/src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj index 4d7e9cd2bd7c18ee70c3cf648364064745bd19c1..27f18f7217b0ae4e5df9cc8d9cfd5206fcbbe861 100644 --- a/src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj +++ b/src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj @@ -4,7 +4,7 @@ Library Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests - netcoreapp3.1;net472 + net5.0;net472 true diff --git a/src/Compilers/CSharp/Test/Emit/Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj b/src/Compilers/CSharp/Test/Emit/Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj index 625b7be3e1377ba414a03aff422afb2850808468..ec0cda63c4f1c70a593b6155737161d35766a5d5 100644 --- a/src/Compilers/CSharp/Test/Emit/Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj +++ b/src/Compilers/CSharp/Test/Emit/Microsoft.CodeAnalysis.CSharp.Emit.UnitTests.csproj @@ -4,7 +4,7 @@ Library Microsoft.CodeAnalysis.CSharp.UnitTests - netcoreapp3.1;net472 + net5.0;net472 true diff --git a/src/Compilers/CSharp/Test/IOperation/Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests.csproj b/src/Compilers/CSharp/Test/IOperation/Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests.csproj index 614ec6dec028c81c0dea6dc18c10343cc62a6210..7346c1eeb7bab5d473e2e6d380f685c847936f81 100644 --- a/src/Compilers/CSharp/Test/IOperation/Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests.csproj +++ b/src/Compilers/CSharp/Test/IOperation/Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests.csproj @@ -4,7 +4,7 @@ Library Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests - netcoreapp3.1;net472 + net5.0;net472 diff --git a/src/Compilers/CSharp/Test/Semantic/Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests.csproj b/src/Compilers/CSharp/Test/Semantic/Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests.csproj index d768bd07eff33da0eec9d3ffe7677017851b1e3f..a388a889b72cd437d521783c91ab0baa22f64ae4 100644 --- a/src/Compilers/CSharp/Test/Semantic/Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests.csproj +++ b/src/Compilers/CSharp/Test/Semantic/Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests.csproj @@ -4,7 +4,7 @@ Library Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests - netcoreapp3.1;net472 + net5.0;net472 diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/NativeIntegerTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/NativeIntegerTests.cs index 0b8b89d2340cd2e560ffee6e486c345e27d10139..b28aab13ba751fbc15c4685b24c42dd5635070fa 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/NativeIntegerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/NativeIntegerTests.cs @@ -16,6 +16,7 @@ using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; +using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics { diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs index e68ad76ec08e2ea4c60cd099ccfde1f14e8b930a..1a310e687ddf1265ec87003ce84b55f9975014d1 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs @@ -16,6 +16,7 @@ using Roslyn.Utilities; using Microsoft.CodeAnalysis.Diagnostics; using static Roslyn.Test.Utilities.TestMetadata; +using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; namespace Microsoft.CodeAnalysis.CSharp.UnitTests { diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTestBase.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTestBase.cs index 8419db67dd2b5aef002ba122f9a636ef4d1469ee..fa7d739b766d89d423139eaa62a5d3535ce978bc 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTestBase.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTestBase.cs @@ -12,6 +12,7 @@ using Roslyn.Test.Utilities; using Xunit; using Roslyn.Utilities; +using ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer; namespace Microsoft.CodeAnalysis.CSharp.UnitTests { diff --git a/src/Compilers/CSharp/Test/Symbol/Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests.csproj b/src/Compilers/CSharp/Test/Symbol/Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests.csproj index 8677c4fded935a56d56ad97b80bfa37d55e6fed8..e0753bd60f7f9d062b5666c573aa7cff879ba583 100644 --- a/src/Compilers/CSharp/Test/Symbol/Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests.csproj +++ b/src/Compilers/CSharp/Test/Symbol/Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests.csproj @@ -5,7 +5,7 @@ Library Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests true - netcoreapp3.1;net472 + net5.0;net472 true diff --git a/src/Compilers/CSharp/Test/Syntax/Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests.csproj b/src/Compilers/CSharp/Test/Syntax/Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests.csproj index 49eef0e4adacd8cdcc200384004d53383ef51157..607a2b9e94c657e8bd43d6bc20c96a23ede5b9f4 100644 --- a/src/Compilers/CSharp/Test/Syntax/Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests.csproj +++ b/src/Compilers/CSharp/Test/Syntax/Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests.csproj @@ -7,7 +7,7 @@ false true true - netcoreapp3.1;net472 + net5.0;net472 $(NoWarn);1570;1587 diff --git a/src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj b/src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj index b1aaf326b54420bfd79503a20118b02d5d6d48a8..6165d42e4f90f60435c28920ccfb29097108323a 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj +++ b/src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj @@ -5,7 +5,7 @@ Library Microsoft.CodeAnalysis.UnitTests true - netcoreapp3.1;net472 + net5.0;net472 diff --git a/src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs b/src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs index 08d494495669b54c546828fb43d5ee5d8e919828..1f6153b33f41b79e8b033c28cd2fed4719cc2f24 100644 --- a/src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs +++ b/src/Compilers/Core/MSBuildTaskTests/MapSourceRootTests.cs @@ -342,6 +342,7 @@ public void MetadataMerge1(bool deterministic) "MapSourceRoots.ContainsDuplicate", "SourceRoot", path1, "SourceLinkUrl", "URL1", "URL2")) + Environment.NewLine, engine.Log); + AssertEx.NotNull(task.MappedSourceRoots); AssertEx.Equal(new[] { $"'{path1}' SourceControl='git' RevisionId='RevId1' NestedRoot='NR1A' ContainingRoot='{path3}' MappedPath='{(deterministic ? "/_/NR1A/" : path1)}' SourceLinkUrl='URL1'", @@ -446,6 +447,7 @@ public void Error_NoTopLevelSourceRoot(bool deterministic) } else { + AssertEx.NotNull(task.MappedSourceRoots); AssertEx.Equal(new[] { $"'{path1}' SourceControl='' RevisionId='' NestedRoot='a/b' ContainingRoot='{path1}' MappedPath='{path1}' SourceLinkUrl=''", diff --git a/src/Compilers/Core/MSBuildTaskTests/Microsoft.Build.Tasks.CodeAnalysis.UnitTests.csproj b/src/Compilers/Core/MSBuildTaskTests/Microsoft.Build.Tasks.CodeAnalysis.UnitTests.csproj index 91e59ab9621dc636c11baf16cdf37c9655557abf..8e24e13493f4f79fc3d3fadefa566b5a7e64df66 100644 --- a/src/Compilers/Core/MSBuildTaskTests/Microsoft.Build.Tasks.CodeAnalysis.UnitTests.csproj +++ b/src/Compilers/Core/MSBuildTaskTests/Microsoft.Build.Tasks.CodeAnalysis.UnitTests.csproj @@ -5,7 +5,7 @@ Library Microsoft.CodeAnalysis.BuildTasks.UnitTests true - netcoreapp3.1;net472 + net5.0;net472 enable diff --git a/src/Compilers/Core/MSBuildTaskTests/TargetTests.cs b/src/Compilers/Core/MSBuildTaskTests/TargetTests.cs index c0f6b2e0d021f198e897bd8d87b4725f76dd046a..c7a9ae418599c8753f218277a4c42d6239c0d504 100644 --- a/src/Compilers/Core/MSBuildTaskTests/TargetTests.cs +++ b/src/Compilers/Core/MSBuildTaskTests/TargetTests.cs @@ -15,6 +15,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Xml; +using Roslyn.Test.Utilities; using Microsoft.Build.Evaluation; using Microsoft.Build.Execution; using Microsoft.Build.Framework; @@ -265,15 +266,15 @@ public void GenerateEditorConfigCoreEvaluatesMetadata() Assert.Equal("_GeneratedEditorConfigMetadata", item.ItemType); var itemType = item.Metadata.SingleOrDefault(m => m.Name == "ItemType"); - Assert.NotNull(itemType); + AssertEx.NotNull(itemType); Assert.Equal("Compile", itemType.EvaluatedValue); var metaName = item.Metadata.SingleOrDefault(m => m.Name == "MetadataName"); - Assert.NotNull(metaName); + AssertEx.NotNull(metaName); Assert.Equal("CustomMeta", metaName.EvaluatedValue); var customMeta = item.Metadata.SingleOrDefault(m => m.Name == metaName.EvaluatedValue); - Assert.NotNull(customMeta); + AssertEx.NotNull(customMeta); Assert.Equal("abc", customMeta.EvaluatedValue); } @@ -307,15 +308,15 @@ public void GenerateEditorConfigCoreEvaluatesDynamicMetadata() Assert.Equal("_GeneratedEditorConfigMetadata", item.ItemType); var itemType = item.Metadata.SingleOrDefault(m => m.Name == "ItemType"); - Assert.NotNull(itemType); + AssertEx.NotNull(itemType); Assert.Equal("Compile", itemType.EvaluatedValue); var metaName = item.Metadata.SingleOrDefault(m => m.Name == "MetadataName"); - Assert.NotNull(metaName); + AssertEx.NotNull(metaName); Assert.Equal("CustomMeta", metaName.EvaluatedValue); var customMeta = item.Metadata.SingleOrDefault(m => m.Name == metaName.EvaluatedValue); - Assert.NotNull(customMeta); + AssertEx.NotNull(customMeta); Assert.Equal("abc", customMeta.EvaluatedValue); } @@ -347,11 +348,11 @@ public void GenerateEditorConfigCoreHandlesMissingMetadata() Assert.Equal("_GeneratedEditorConfigMetadata", item.ItemType); var itemType = item.Metadata.SingleOrDefault(m => m.Name == "ItemType"); - Assert.NotNull(itemType); + AssertEx.NotNull(itemType); Assert.Equal("Compile", itemType.EvaluatedValue); var metaName = item.Metadata.SingleOrDefault(m => m.Name == "MetadataName"); - Assert.NotNull(metaName); + AssertEx.NotNull(metaName); Assert.Equal("CustomMeta", metaName.EvaluatedValue); } @@ -382,11 +383,11 @@ public void GenerateEditorConfigCoreHandlesMalformedCompilerVisibleItemMetadata( Assert.Equal("_GeneratedEditorConfigMetadata", item.ItemType); var itemType = item.Metadata.SingleOrDefault(m => m.Name == "ItemType"); - Assert.NotNull(itemType); + AssertEx.NotNull(itemType); Assert.Equal("Compile", itemType.EvaluatedValue); var metaName = item.Metadata.SingleOrDefault(m => m.Name == "MetadataName"); - Assert.NotNull(metaName); + AssertEx.NotNull(metaName); Assert.Equal("", metaName.EvaluatedValue); } diff --git a/src/Compilers/Server/VBCSCompilerTests/VBCSCompiler.UnitTests.csproj b/src/Compilers/Server/VBCSCompilerTests/VBCSCompiler.UnitTests.csproj index 82b401a580a800c30a969c8b2797a3671624cc7a..a51965c86a11d1571d2fe6a4e6cf1f13d88cf4e4 100644 --- a/src/Compilers/Server/VBCSCompilerTests/VBCSCompiler.UnitTests.csproj +++ b/src/Compilers/Server/VBCSCompilerTests/VBCSCompiler.UnitTests.csproj @@ -5,7 +5,7 @@ Library Microsoft.CodeAnalysis.CompilerServer.UnitTests true - netcoreapp3.1;net472 + net5.0;net472 diff --git a/src/Compilers/VisualBasic/Test/IOperation/Roslyn.Compilers.VisualBasic.IOperation.UnitTests.vbproj b/src/Compilers/VisualBasic/Test/IOperation/Roslyn.Compilers.VisualBasic.IOperation.UnitTests.vbproj index 5cb7be9c6df0e2c06b906fad58cb2b52e879425b..7813c56ae51e110bb789812323e5668ce8d5e9b7 100644 --- a/src/Compilers/VisualBasic/Test/IOperation/Roslyn.Compilers.VisualBasic.IOperation.UnitTests.vbproj +++ b/src/Compilers/VisualBasic/Test/IOperation/Roslyn.Compilers.VisualBasic.IOperation.UnitTests.vbproj @@ -3,7 +3,7 @@ Library - netcoreapp3.1;net472 + net5.0;net472 diff --git a/src/Compilers/VisualBasic/Test/Semantic/Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests.vbproj b/src/Compilers/VisualBasic/Test/Semantic/Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests.vbproj index 5224f9fa766c69880e2c66bb75d9ee32cd8bb5dd..834db09c0714a91d0a1f505e6bcff8e571e50346 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests.vbproj +++ b/src/Compilers/VisualBasic/Test/Semantic/Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests.vbproj @@ -3,7 +3,7 @@ Library - netcoreapp3.1;net472 + net5.0;net472 diff --git a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/InstantiatingGenerics.vb b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/InstantiatingGenerics.vb index 5d1309d8553033a30d635953ddb91727564e89d9..dac4e2057400e72752180014e419f0154817f690 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/InstantiatingGenerics.vb +++ b/src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/InstantiatingGenerics.vb @@ -11,7 +11,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Roslyn.Test.Utilities - +Imports ReferenceEqualityComparer = Roslyn.Utilities.ReferenceEqualityComparer Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols diff --git a/src/Compilers/VisualBasic/Test/Syntax/Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests.vbproj b/src/Compilers/VisualBasic/Test/Syntax/Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests.vbproj index d5430086b3d1d35b085c7da60935e6b9a71fdb8c..ff75b93c9703b4fd781f0689106a478b03f0fe46 100644 --- a/src/Compilers/VisualBasic/Test/Syntax/Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests.vbproj +++ b/src/Compilers/VisualBasic/Test/Syntax/Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests.vbproj @@ -3,7 +3,7 @@ Library - netcoreapp3.1;net472 + net5.0;net472 diff --git a/src/Test/Utilities/Portable/Assert/AssertEx.cs b/src/Test/Utilities/Portable/Assert/AssertEx.cs index 18a2b6a5ceb5fc07184849fb56f6ca68d133f693..ffbdb4fd0f3ddc130c4d8b2bc9bf2b36e894eccd 100644 --- a/src/Test/Utilities/Portable/Assert/AssertEx.cs +++ b/src/Test/Utilities/Portable/Assert/AssertEx.cs @@ -6,6 +6,8 @@ using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; @@ -793,5 +795,14 @@ public static void Equal(T[,] expected, Func getResult, Func([NotNull] T value) + { + Assert.NotNull(value); + Debug.Assert(value is object); + } + +#nullable disable } } diff --git a/src/Workspaces/CoreTestUtilities/Roslyn.Services.UnitTests.Utilities.csproj b/src/Workspaces/CoreTestUtilities/Roslyn.Services.UnitTests.Utilities.csproj index ef2474dc401e2b88aed66e45544520132c902536..55df11539446abb18a8b1015235dab18f7bcffe1 100644 --- a/src/Workspaces/CoreTestUtilities/Roslyn.Services.UnitTests.Utilities.csproj +++ b/src/Workspaces/CoreTestUtilities/Roslyn.Services.UnitTests.Utilities.csproj @@ -4,7 +4,7 @@ Library Microsoft.CodeAnalysis.UnitTests - netcoreapp3.1;net472 + net5.0;netcoreapp3.1;net472 true false true