diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb7cf564de..74a9c20cb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,9 @@ name: 'Build' env: - DotNetVersion: "8.0.100-rc.1.23463.5" - DotNetVersion2: "7.0.302" - DotNetVersion3: "6.0.203" + DotNetVersion: "8.0.100" + DotNetVersion2: "7.0.404" + DotNetVersion3: "6.0.203" # This is the last version Mono supports. It is used for our Mono CI tests. NuGetVersion: "6.5.0" MonoVersion: "6.12.0" Artifacts: ${{ github.workspace }}/artifacts/ diff --git a/.github/workflows/tests-net6.yml b/.github/workflows/tests-net6.yml index c3818e31cc..3600c6285a 100644 --- a/.github/workflows/tests-net6.yml +++ b/.github/workflows/tests-net6.yml @@ -1,9 +1,9 @@ name: 'Tests net6.0' env: - DotNetVersion: "8.0.100-rc.1.23463.5" - DotNetVersion2: "7.0.302" - DotNetVersion3: "6.0.203" + DotNetVersion: "8.0.100" + DotNetVersion2: "7.0.404" + DotNetVersion3: "6.0.203" # This is the last version Mono supports. It is used for our Mono CI tests. NuGetVersion: "6.5.0" MonoVersion: "6.12.0" Artifacts: ${{ github.workspace }}/artifacts/ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aea7444a09..7fbebfd7b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,9 +1,9 @@ name: 'Tests' env: - DotNetVersion: "8.0.100-rc.1.23463.5" - DotNetVersion2: "7.0.302" - DotNetVersion3: "6.0.203" + DotNetVersion: "8.0.100" + DotNetVersion2: "7.0.404" + DotNetVersion3: "6.0.203" # This is the last version Mono supports. It is used for our Mono CI tests. NuGetVersion: "6.5.0" MonoVersion: "6.12.0" Artifacts: ${{ github.workspace }}/artifacts/ diff --git a/.pipelines/init.yml b/.pipelines/init.yml index 28f941900d..d89ad13d59 100644 --- a/.pipelines/init.yml +++ b/.pipelines/init.yml @@ -1,9 +1,9 @@ parameters: # Configuration: Release Verbosity: Normal - DotNetVersion: "8.0.100-rc.1.23463.5" - DotNetVersion2: "7.0.302" - DotNetVersion3: "6.0.203" + DotNetVersion: "8.0.100" + DotNetVersion2: "7.0.404" + DotNetVersion3: "6.0.203" # This is the last version Mono supports. It is used for our Mono CI tests. CakeVersion: "1.1.0" NuGetVersion: "5.7.0" MonoVersion: '' diff --git a/Directory.Packages.props b/Directory.Packages.props index f86f09ba49..81e3c97cd0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,28 +5,28 @@ true 0.19.9 - 7.0.0 - 17.6.0 + 8.0.0 + 17.8.0 17.3.2 - 6.8.0-preview.1.69 - 4.9.0-1.23504.3 - 2.4.1 + 6.8.0-rc.122 + 4.9.0-3.23611.3 + 2.6.1 - - + + - + - + - + @@ -39,6 +39,7 @@ + @@ -58,15 +59,12 @@ - + - - - @@ -85,26 +83,25 @@ - - - - + + + + + - - + + + - - - - + - + diff --git a/NuGet.Config b/NuGet.Config index bf19599040..890151406e 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -18,6 +18,7 @@ + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d2c4a20444..00c578bd29 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,7 +32,7 @@ resources: variables: Verbosity: Diagnostic - DotNetVersion: "8.0.100-rc.1.23463.5" + DotNetVersion: "8.0.100" CakeVersion: "3.0.0" NuGetVersion: "6.5.0" GitVersionVersion: "5.0.1" diff --git a/build.cake b/build.cake index 345ef50754..5857a75d8b 100644 --- a/build.cake +++ b/build.cake @@ -49,8 +49,10 @@ Task("Cleanup") Task("GitVersion") .WithCriteria(!BuildSystem.IsLocalBuild) .WithCriteria(!AzurePipelines.IsRunningOnAzurePipelines) - .Does(() => { - GitVersion(new GitVersionSettings{ + .Does(() => + { + GitVersion(new GitVersionSettings + { OutputType = GitVersionOutput.BuildServer }); }); @@ -153,16 +155,20 @@ Task("PrepareTestAssets:CommonTestAssets") var folder = CombinePaths(env.Folders.TestAssets, "test-projects", project); - try { + try + { DotNetBuild(folder, new DotNetBuildSettings() { ToolPath = env.DotNetCommand, WorkingDirectory = folder, Verbosity = DotNetVerbosity.Minimal }); - } catch { + } + catch + { // ExternalAlias has issues once in a while, try building again to get it working. - if (project == "ExternAlias") { + if (project == "ExternAlias") + { DotNetBuild(folder, new DotNetBuildSettings() { @@ -216,7 +222,8 @@ Task("PrepareTestAssets:CakeTestAssets") var toolsFolder = CombinePaths(env.Folders.TestAssets, "test-projects", project, "tools"); var packagesConfig = CombinePaths(toolsFolder, "packages.config"); - NuGetInstallFromConfig(packagesConfig, new NuGetInstallSettings { + NuGetInstallFromConfig(packagesConfig, new NuGetInstallSettings + { OutputDirectory = toolsFolder, Prerelease = true, Verbosity = NuGetVerbosity.Quiet, @@ -248,7 +255,8 @@ void BuildWithDotNetCli(BuildEnvironment env, string configuration) }; settings.AddFileLogger( - new MSBuildFileLoggerSettings { + new MSBuildFileLoggerSettings + { AppendToLogFile = false, LogFile = logFileNameBase + ".log", ShowTimestamp = true, @@ -294,51 +302,51 @@ Task("Test") .IsDependentOn("PrepareTestAssets") .Does(() => { - var testTargetFramework = useDotNetTest ? "net7.0" : "net472"; - var testProjects = string.IsNullOrEmpty(testProjectArgument) ? buildPlan.TestProjects : testProjectArgument.Split(','); - foreach (var testProject in testProjects) + var testTargetFramework = useDotNetTest ? "net7.0" : "net472"; + var testProjects = string.IsNullOrEmpty(testProjectArgument) ? buildPlan.TestProjects : testProjectArgument.Split(','); + foreach (var testProject in testProjects) + { + PrintBlankLine(); + var instanceFolder = CombinePaths(env.Folders.Bin, configuration, testProject, testTargetFramework); + var targetPath = CombinePaths(instanceFolder, $"{testProject}.dll"); + + if (useDotNetTest) { - PrintBlankLine(); - var instanceFolder = CombinePaths(env.Folders.Bin, configuration, testProject, testTargetFramework); - var targetPath = CombinePaths(instanceFolder, $"{testProject}.dll"); + var logFile = CombinePaths(env.Folders.ArtifactsLogs, $"{testProject}-netsdk-result.xml"); + var arguments = $"test \"{targetPath}\" --logger \"console;verbosity=normal\" --logger \"trx;LogFileName={logFile}\" --blame-hang-timeout 60sec"; - if (useDotNetTest) - { - var logFile = CombinePaths(env.Folders.ArtifactsLogs, $"{testProject}-netsdk-result.xml"); - var arguments = $"test \"{targetPath}\" --logger \"console;verbosity=normal\" --logger \"trx;LogFileName={logFile}\" --blame-hang-timeout 60sec"; + Console.WriteLine($"Executing: dotnet {arguments}"); - Console.WriteLine($"Executing: dotnet {arguments}"); + Run("dotnet", arguments, instanceFolder) + .ExceptionOnError($"Test {testProject} failed for {testTargetFramework}"); + } + else + { + var logFile = CombinePaths(env.Folders.ArtifactsLogs, $"{testProject}-desktop-result.xml"); + + // Copy xunit executable to test folder to solve path errors + var xunitToolsFolder = CombinePaths(env.Folders.Tools, "xunit.runner.console", "tools", "net452"); + var xunitInstancePath = CombinePaths(instanceFolder, "xunit.console.exe"); + FileHelper.Copy(CombinePaths(xunitToolsFolder, "xunit.console.exe"), xunitInstancePath, overwrite: true); + FileHelper.Copy(CombinePaths(xunitToolsFolder, "xunit.runner.utility.net452.dll"), CombinePaths(instanceFolder, "xunit.runner.utility.net452.dll"), overwrite: true); + var arguments = $"\"{targetPath}\" -noshadow -parallel none -xml \"{logFile}\" -notrait category=failing"; - Run("dotnet", arguments, instanceFolder) + if (Platform.Current.IsWindows) + { + Run(xunitInstancePath, arguments, instanceFolder) .ExceptionOnError($"Test {testProject} failed for {testTargetFramework}"); } else { - var logFile = CombinePaths(env.Folders.ArtifactsLogs, $"{testProject}-desktop-result.xml"); + // Copy the Mono-built Microsoft.Build.* binaries to the test folder. + // This is necessary to work around a Mono bug that is exasperated by xUnit. + CopyMonoMSBuildBinaries(instanceFolder); - // Copy xunit executable to test folder to solve path errors - var xunitToolsFolder = CombinePaths(env.Folders.Tools, "xunit.runner.console", "tools", "net452"); - var xunitInstancePath = CombinePaths(instanceFolder, "xunit.console.exe"); - FileHelper.Copy(CombinePaths(xunitToolsFolder, "xunit.console.exe"), xunitInstancePath, overwrite: true); - FileHelper.Copy(CombinePaths(xunitToolsFolder, "xunit.runner.utility.net452.dll"), CombinePaths(instanceFolder, "xunit.runner.utility.net452.dll"), overwrite: true); - var arguments = $"\"{targetPath}\" -noshadow -parallel none -xml \"{logFile}\" -notrait category=failing"; - - if (Platform.Current.IsWindows) - { - Run(xunitInstancePath, arguments, instanceFolder) - .ExceptionOnError($"Test {testProject} failed for {testTargetFramework}"); - } - else - { - // Copy the Mono-built Microsoft.Build.* binaries to the test folder. - // This is necessary to work around a Mono bug that is exasperated by xUnit. - CopyMonoMSBuildBinaries(instanceFolder); - - Run("mono", $"\"{xunitInstancePath}\" {arguments}", instanceFolder) - .ExceptionOnError($"Test {testProject} failed for net472"); - } + Run("mono", $"\"{xunitInstancePath}\" {arguments}", instanceFolder) + .ExceptionOnError($"Test {testProject} failed for net472"); } } + } }); void CopyMonoMSBuildBinaries(string outputFolder) @@ -370,7 +378,7 @@ void CopyExtraDependencies(BuildEnvironment env, string outputFolder) FileHelper.Copy(CombinePaths(env.WorkingDirectory, "license.md"), CombinePaths(outputFolder, "license.md"), overwrite: true); } -void AddOmniSharpBindingRedirects(string omnisharpFolder) +void UpdateBindingRedirects(string omnisharpFolder) { var appConfig = CombinePaths(omnisharpFolder, "OmniSharp.exe.config"); if (!FileHelper.Exists(appConfig)) @@ -397,6 +405,17 @@ void AddOmniSharpBindingRedirects(string omnisharpFolder) assemblyBinding.AppendChild(redirect); } + // Find Roslyn libraries + foreach (var filePath in System.IO.Directory.GetFiles(omnisharpFolder, "Microsoft.CodeAnalysis.*.dll")) + { + // Read assembly name from Roslyn library + var assemblyName = AssemblyName.GetAssemblyName(filePath); + + // Create binding redirect and add to bindings + var redirect = CreateBindingRedirect(document, assemblyName); + assemblyBinding.AppendChild(redirect); + } + runtime.AppendChild(assemblyBinding); // Save updated app.config @@ -433,7 +452,7 @@ string PublishMonoBuild(string project, BuildEnvironment env, BuildPlan plan, st DirectoryHelper.Copy(buildFolder, outputFolder, copySubDirectories: false); CopyExtraDependencies(env, outputFolder); - AddOmniSharpBindingRedirects(outputFolder); + UpdateBindingRedirects(outputFolder); // Copy dependencies of Mono build FileHelper.Copy( @@ -470,7 +489,7 @@ string PublishMonoBuildForPlatform(string project, MonoRuntime monoRuntime, Buil Run("chmod", $"+x \"{CombinePaths(outputFolder, "run")}\""); CopyExtraDependencies(env, outputFolder); - AddOmniSharpBindingRedirects(omnisharpFolder); + UpdateBindingRedirects(omnisharpFolder); Package(project, monoRuntime.PlatformName, outputFolder, env.Folders.ArtifactsPackage, env.Folders.DeploymentPackage); @@ -555,7 +574,6 @@ Task("PublishNet6Builds") PublishBuild(project, env, buildPlan, configuration, "linux-musl-arm64", "net6.0"); } } - } }); @@ -597,7 +615,7 @@ string PublishBuild(string project, BuildEnvironment env, BuildPlan plan, string } CopyExtraDependencies(env, outputFolder); - AddOmniSharpBindingRedirects(outputFolder); + UpdateBindingRedirects(outputFolder); var platformFolder = framework != "net472" ? $"{rid}-{framework}" : rid; Package(project, platformFolder, outputFolder, env.Folders.ArtifactsPackage, env.Folders.DeploymentPackage); @@ -645,8 +663,10 @@ Task("PublishWindowsBuilds") Task("PublishNuGet") .IsDependentOn("InstallDotNetSdk") - .Does(() => { - DotNetPack(".", new DotNetPackSettings() { + .Does(() => + { + DotNetPack(".", new DotNetPackSettings() + { Configuration = "Release", OutputDirectory = "./artifacts/nuget/", MSBuildSettings = new DotNetMSBuildSettings() diff --git a/build.json b/build.json index d4869b6928..3fa3d3f998 100644 --- a/build.json +++ b/build.json @@ -3,8 +3,8 @@ "DotNetChannel": "Preview", "DotNetVersions": [ "6.0.203", - "7.0.302", - "8.0.100-rc.1.23463.5" + "7.0.404", + "8.0.100" ], "RequiredMonoVersion": "6.6.0", "DownloadURL": "https://roslynomnisharp.blob.core.windows.net/ext", @@ -15,13 +15,13 @@ "TestProjects": [ "OmniSharp.MSBuild.Tests", "OmniSharp.Roslyn.CSharp.Tests", - "OmniSharp.Http.Tests", - "OmniSharp.Stdio.Tests", "OmniSharp.DotNetTest.Tests", - "OmniSharp.Tests", - "OmniSharp.Cake.Tests", + "OmniSharp.Lsp.Tests", "OmniSharp.Script.Tests", - "OmniSharp.Lsp.Tests" + "OmniSharp.Cake.Tests", + "OmniSharp.Http.Tests", + "OmniSharp.Stdio.Tests", + "OmniSharp.Tests" ], "TestAssets": [ "NUnitTestProject", @@ -54,4 +54,4 @@ "RestoreOnlyTestAssets": [ "ProjectWithMissingType" ] -} +} \ No newline at end of file diff --git a/build/Settings.props b/build/Settings.props index 11af6c466f..70d25f23f0 100644 --- a/build/Settings.props +++ b/build/Settings.props @@ -2,7 +2,7 @@ - 10.0 + 12.0 true Debug true @@ -32,6 +32,25 @@ $(MSBuildThisFileDirectory)\OmniSharpKey.snk + + true + + + + + 15.1.0.0 + + + 15.1.0.0 + + + 15.1.0.0 + + + 15.1.0.0 + + + diff --git a/global.json b/global.json index ff9d0be2a6..9b4f20aac0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100-rc.1.23463.5", + "version": "8.0.100", "rollForward": "latestMinor" } } diff --git a/src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj b/src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj index c28a9288d9..d42e74e077 100644 --- a/src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj +++ b/src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj @@ -18,7 +18,6 @@ - diff --git a/src/OmniSharp.Host/MSBuild/Discovery/Interop.cs b/src/OmniSharp.Host/MSBuild/Discovery/Interop.cs deleted file mode 100644 index f053bc9964..0000000000 --- a/src/OmniSharp.Host/MSBuild/Discovery/Interop.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using Microsoft.VisualStudio.Setup.Configuration; - -namespace OmniSharp.MSBuild.Discovery -{ - internal static class Interop - { - private const int REGDG_E_CLASSNOTREG = unchecked((int)0x80040154); - - [DllImport("Microsoft.VisualStudio.Setup.Configuration.Native.dll", ExactSpelling = true, PreserveSig = true)] - private static extern int GetSetupConfiguration( - [MarshalAs(UnmanagedType.Interface), Out] out ISetupConfiguration configuration, - IntPtr reserved); - - public static ISetupConfiguration2 GetSetupConfiguration() - { - try - { - return new SetupConfiguration(); - } - catch (COMException ex) when (ex.ErrorCode == REGDG_E_CLASSNOTREG) - { - // We could not CoCreate the SetupConfiguration object. If that fails, try p/invoking. - var hresult = GetSetupConfiguration(out var configuration, IntPtr.Zero); - - if (hresult < 0) - { - throw new COMException($"Failed to get {nameof(ISetupConfiguration)}", hresult); - } - - return configuration as ISetupConfiguration2; - } - } - } -} diff --git a/src/OmniSharp.Host/OmniSharp.Host.csproj b/src/OmniSharp.Host/OmniSharp.Host.csproj index a2faea592f..d0d45722c9 100644 --- a/src/OmniSharp.Host/OmniSharp.Host.csproj +++ b/src/OmniSharp.Host/OmniSharp.Host.csproj @@ -27,8 +27,6 @@ - - diff --git a/src/OmniSharp.Http.Driver/app.config b/src/OmniSharp.Http.Driver/app.config deleted file mode 100644 index 0d4b36420e..0000000000 --- a/src/OmniSharp.Http.Driver/app.config +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/OmniSharp.LanguageServerProtocol/app.config b/src/OmniSharp.LanguageServerProtocol/app.config deleted file mode 100644 index a7df8afbcb..0000000000 --- a/src/OmniSharp.LanguageServerProtocol/app.config +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj b/src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj index 5de02185b1..da76c088f5 100644 --- a/src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj +++ b/src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj @@ -16,10 +16,15 @@ - - - + + + + + + + + diff --git a/src/OmniSharp.Stdio.Driver/app.config b/src/OmniSharp.Stdio.Driver/app.config deleted file mode 100644 index 0d4b36420e..0000000000 --- a/src/OmniSharp.Stdio.Driver/app.config +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test-assets/test-projects/Net70Project/global.json b/test-assets/test-projects/Net70Project/global.json index e7a6251dc2..64c469899c 100644 --- a/test-assets/test-projects/Net70Project/global.json +++ b/test-assets/test-projects/Net70Project/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "7.0.302" + "version": "7.0.404" } -} \ No newline at end of file +} diff --git a/test-assets/test-projects/Net80Project/global.json b/test-assets/test-projects/Net80Project/global.json index 9464089fc5..48e1c84489 100644 --- a/test-assets/test-projects/Net80Project/global.json +++ b/test-assets/test-projects/Net80Project/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.100-rc.1.23463.5" + "version": "8.0.100" } -} \ No newline at end of file +} diff --git a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj index 1ef6ceb217..7358d5b9ad 100644 --- a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj +++ b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj @@ -13,10 +13,6 @@ - - - - diff --git a/tests/OmniSharp.DotNetTest.Tests/OmniSharp.DotNetTest.Tests.csproj b/tests/OmniSharp.DotNetTest.Tests/OmniSharp.DotNetTest.Tests.csproj index 0131815f44..53dbc5e0ba 100644 --- a/tests/OmniSharp.DotNetTest.Tests/OmniSharp.DotNetTest.Tests.csproj +++ b/tests/OmniSharp.DotNetTest.Tests/OmniSharp.DotNetTest.Tests.csproj @@ -6,10 +6,6 @@ true - - - - diff --git a/tests/OmniSharp.DotNetTest.Tests/TestDiscoveryFacts.cs b/tests/OmniSharp.DotNetTest.Tests/TestDiscoveryFacts.cs index ed14749a90..f85ca54da2 100644 --- a/tests/OmniSharp.DotNetTest.Tests/TestDiscoveryFacts.cs +++ b/tests/OmniSharp.DotNetTest.Tests/TestDiscoveryFacts.cs @@ -117,7 +117,7 @@ private async Task AssertWithCodeStructure(OmniSharpTestHost host, string filePa } else { - Assert.True(false, "Did not find test method."); + Assert.Fail("Did not find test method."); } } } diff --git a/tests/OmniSharp.Http.Tests/OmniSharp.Http.Tests.csproj b/tests/OmniSharp.Http.Tests/OmniSharp.Http.Tests.csproj index f924453898..caf8cc7aef 100644 --- a/tests/OmniSharp.Http.Tests/OmniSharp.Http.Tests.csproj +++ b/tests/OmniSharp.Http.Tests/OmniSharp.Http.Tests.csproj @@ -6,10 +6,6 @@ true - - - - diff --git a/tests/OmniSharp.Lsp.Tests/LanguageServerFoundationFacts.cs b/tests/OmniSharp.Lsp.Tests/LanguageServerFoundationFacts.cs index e0e4dd83a7..c1101de1f6 100644 --- a/tests/OmniSharp.Lsp.Tests/LanguageServerFoundationFacts.cs +++ b/tests/OmniSharp.Lsp.Tests/LanguageServerFoundationFacts.cs @@ -83,7 +83,7 @@ public async Task All_known_OmniSharp_handlers_are_callable(string method) } catch (MethodNotSupportedException) { - Assert.False(true, "Method should be supported!"); + Assert.Fail("Method should be supported!"); } catch (Exception e) { diff --git a/tests/OmniSharp.Lsp.Tests/OmniSharp.Lsp.Tests.csproj b/tests/OmniSharp.Lsp.Tests/OmniSharp.Lsp.Tests.csproj index cb07536736..b66f7bbab2 100644 --- a/tests/OmniSharp.Lsp.Tests/OmniSharp.Lsp.Tests.csproj +++ b/tests/OmniSharp.Lsp.Tests/OmniSharp.Lsp.Tests.csproj @@ -6,10 +6,6 @@ true - - - - diff --git a/tests/OmniSharp.Lsp.Tests/OmniSharpSemanticTokensHandlerFacts.cs b/tests/OmniSharp.Lsp.Tests/OmniSharpSemanticTokensHandlerFacts.cs index 059e13e471..2326a0494e 100644 --- a/tests/OmniSharp.Lsp.Tests/OmniSharpSemanticTokensHandlerFacts.cs +++ b/tests/OmniSharp.Lsp.Tests/OmniSharpSemanticTokensHandlerFacts.cs @@ -396,6 +396,7 @@ private async Task GetSemanticHighlightsAsync(string so .Cast() .Where(value => (tokenModifiers & (1 << value)) != 0) .Cast() + .ToArray() : Enumerable.Empty() }; diff --git a/tests/OmniSharp.MSBuild.Tests/LoadProjectsOnDemandTests.cs b/tests/OmniSharp.MSBuild.Tests/LoadProjectsOnDemandTests.cs index dc7f518e5f..5574c8b19d 100644 --- a/tests/OmniSharp.MSBuild.Tests/LoadProjectsOnDemandTests.cs +++ b/tests/OmniSharp.MSBuild.Tests/LoadProjectsOnDemandTests.cs @@ -33,7 +33,7 @@ public async Task LoadOnDemandProjectsOneByOne() // Expect empty workspace initially since no documents have been requested yet Assert.Null(workspaceInfo.SolutionPath); Assert.NotNull(workspaceInfo.Projects); - Assert.Equal(0, workspaceInfo.Projects.Count); + Assert.Empty(workspaceInfo.Projects); // Requesting library document should load only that project GetCodeActionsService codeActionHandler = host.GetRequestHandler(OmniSharpEndpoints.V2.GetCodeActions); @@ -44,7 +44,7 @@ public async Task LoadOnDemandProjectsOneByOne() Assert.NotNull(codeActionResponse); Assert.Null(workspaceInfo.SolutionPath); Assert.NotNull(workspaceInfo.Projects); - Assert.Equal(1, workspaceInfo.Projects.Count); + Assert.Single(workspaceInfo.Projects); Assert.Equal("Lib.csproj", Path.GetFileName(workspaceInfo.Projects[0].Path)); // Requesting app document should load that project as well @@ -72,7 +72,7 @@ public async Task LoadOnDemandProjectAndItsReference() // Expect empty workspace initially since no documents have been requested yet Assert.Null(workspaceInfo.SolutionPath); Assert.NotNull(workspaceInfo.Projects); - Assert.Equal(0, workspaceInfo.Projects.Count); + Assert.Empty(workspaceInfo.Projects); // Requesting app document should load both projects MembersAsTreeService membersAsTreeService = host.GetRequestHandler(OmniSharpEndpoints.MembersTree); @@ -101,7 +101,7 @@ public async Task LoadOnDemandProjectWithTwoLevelsOfTransitiveReferences() // Expect empty workspace initially since no documents have been requested yet Assert.Null(workspaceInfo.SolutionPath); Assert.NotNull(workspaceInfo.Projects); - Assert.Equal(0, workspaceInfo.Projects.Count); + Assert.Empty(workspaceInfo.Projects); // Requesting the document should load project App, its reference Lib1 and Lib2 that is referenced by Lib1 MembersAsTreeService membersAsTreeService = host.GetRequestHandler(OmniSharpEndpoints.MembersTree); diff --git a/tests/OmniSharp.MSBuild.Tests/OmniSharp.MSBuild.Tests.csproj b/tests/OmniSharp.MSBuild.Tests/OmniSharp.MSBuild.Tests.csproj index 800a1c4bca..3d775335ce 100644 --- a/tests/OmniSharp.MSBuild.Tests/OmniSharp.MSBuild.Tests.csproj +++ b/tests/OmniSharp.MSBuild.Tests/OmniSharp.MSBuild.Tests.csproj @@ -6,10 +6,6 @@ true - - - - diff --git a/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs b/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs index 6a35385019..cc5af5a928 100644 --- a/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs +++ b/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs @@ -231,7 +231,7 @@ public async Task The_correct_sdk_version_is_emitted_NET7() using var testProject = await TestAssets.Instance.GetTestProjectAsync("Net70Project"); using var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory)); Assert.Single(emitter.ReceivedMessages); - Assert.Equal(GetHashedFileExtension("7.0.302"), emitter.ReceivedMessages[0].SdkVersion); + Assert.Equal(GetHashedFileExtension("7.0.404"), emitter.ReceivedMessages[0].SdkVersion); } [ConditionalFact(typeof(DotnetRuntimeOnly))] @@ -243,7 +243,7 @@ public async Task The_correct_sdk_version_is_emitted_NET8() using var testProject = await TestAssets.Instance.GetTestProjectAsync("Net80Project"); using var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory)); Assert.Single(emitter.ReceivedMessages); - Assert.Equal(GetHashedFileExtension("8.0.100-rc.1.23463.5"), emitter.ReceivedMessages[0].SdkVersion); + Assert.Equal(GetHashedFileExtension("8.0.100"), emitter.ReceivedMessages[0].SdkVersion); } private string GetHashedFileExtension(string fileExtension) diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/AbstractGoToDefinitionFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/AbstractGoToDefinitionFacts.cs index 4169788de8..ef875ecca0 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/AbstractGoToDefinitionFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/AbstractGoToDefinitionFacts.cs @@ -469,7 +469,7 @@ public void Baz() { // second comment should indicate we have decompiled var comments = compilationUnit.DescendantTrivia().Where(t => t.IsKind(SyntaxKind.SingleLineCommentTrivia)).ToArray(); Assert.NotNull(comments); - Assert.Equal("// Decompiled with ICSharpCode.Decompiler 7.2.1.6856", comments[1].ToString()); + Assert.Equal("// Decompiled with ICSharpCode.Decompiler 8.2.0.7535", comments[1].ToString()); // contrary to regular metadata, we should have methods with full bodies // this condition would fail if decompilation wouldn't work diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/AnalyzerWorkerQueueFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/AnalyzerWorkerQueueFacts.cs index 7742c82186..7a6bd08a19 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/AnalyzerWorkerQueueFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/AnalyzerWorkerQueueFacts.cs @@ -10,6 +10,7 @@ namespace OmniSharp.Roslyn.CSharp.Tests { +#pragma warning disable xUnit1031 // Test methods should not use blocking task operations public class AnalyzerWorkerQueueFacts { private class Logger : ILogger @@ -53,7 +54,7 @@ public void Dispose() public void WhenItemsAreAddedButThrotlingIsntOverNoWorkShouldBeReturned(AnalyzerWorkType workType) { var now = DateTime.UtcNow; - var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10*1000); + var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10 * 1000); var document = CreateTestDocumentId(); queue.PutWork(new[] { document }, workType); @@ -66,7 +67,7 @@ public void WhenItemsAreAddedButThrotlingIsntOverNoWorkShouldBeReturned(Analyzer public void WhenWorksIsAddedToQueueThenTheyWillBeReturned(AnalyzerWorkType workType) { var now = DateTime.UtcNow; - var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10*1000); + var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10 * 1000); var document = CreateTestDocumentId(); queue.PutWork(new[] { document }, workType); @@ -84,7 +85,7 @@ public void WhenWorksIsAddedToQueueThenTheyWillBeReturned(AnalyzerWorkType workT public void WhenSameItemIsAddedMultipleTimesInRowThenThrottleItemAsOne(AnalyzerWorkType workType) { var now = DateTime.UtcNow; - var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10*1000); + var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10 * 1000); var document = CreateTestDocumentId(); queue.PutWork(new[] { document }, workType); @@ -204,7 +205,7 @@ public async Task WhenMultipleThreadsAreConsumingAnalyzerWorkerQueueItWorksAsExp public async Task WhenWorkIsAddedAgainWhenPreviousIsAnalysing_ThenDontWaitAnotherOneToGetReady() { var now = DateTime.UtcNow; - var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10*1000); + var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10 * 1000); var document = CreateTestDocumentId(); queue.PutWork(new[] { document }, AnalyzerWorkType.Foreground); @@ -232,7 +233,7 @@ public async Task WhenWorkIsAddedAgainWhenPreviousIsAnalysing_ThenDontWaitAnothe [Fact] public void WhenBackgroundWorkIsAdded_DontWaitIt() { - var queue = new AnalyzerWorkQueue(new LoggerFactory(), timeoutForPendingWorkMs: 10*1000); + var queue = new AnalyzerWorkQueue(new LoggerFactory(), timeoutForPendingWorkMs: 10 * 1000); var document = CreateTestDocumentId(); queue.PutWork(new[] { document }, AnalyzerWorkType.Background); @@ -244,7 +245,7 @@ public void WhenBackgroundWorkIsAdded_DontWaitIt() public void WhenSingleFileIsPromoted_ThenPromoteItFromBackgroundQueueToForeground() { var now = DateTime.UtcNow; - var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10*1000); + var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10 * 1000); var document = CreateTestDocumentId(); queue.PutWork(new[] { document }, AnalyzerWorkType.Background); @@ -260,7 +261,7 @@ public void WhenSingleFileIsPromoted_ThenPromoteItFromBackgroundQueueToForegroun public void WhenFileIsntAtBackgroundQueueAndTriedToBePromoted_ThenDontDoNothing() { var now = DateTime.UtcNow; - var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10*1000); + var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10 * 1000); var document = CreateTestDocumentId(); queue.TryPromote(document); @@ -274,7 +275,7 @@ public void WhenFileIsntAtBackgroundQueueAndTriedToBePromoted_ThenDontDoNothing( public void WhenFileIsProcessingInBackgroundQueue_ThenPromoteItAsForeground() { var now = DateTime.UtcNow; - var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10*1000); + var queue = new AnalyzerWorkQueue(new LoggerFactory(), utcNow: () => now, timeoutForPendingWorkMs: 10 * 1000); var document = CreateTestDocumentId(); queue.PutWork(new[] { document }, AnalyzerWorkType.Background); diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/AsyncAnalyzerWorkerQueueFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/AsyncAnalyzerWorkerQueueFacts.cs index 7fad2a433f..a68843b639 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/AsyncAnalyzerWorkerQueueFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/AsyncAnalyzerWorkerQueueFacts.cs @@ -11,6 +11,7 @@ namespace OmniSharp.Roslyn.CSharp.Tests { #pragma warning disable VSTHRD103 // Call async methods when in an async method +#pragma warning disable xUnit1031 // Test methods should not use blocking task operations public class AsyncAnalyzerWorkerQueueFacts { private class Logger : ILogger diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/GotoTypeDefinitionFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/GotoTypeDefinitionFacts.cs index cc57e37a29..f6422da3c8 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/GotoTypeDefinitionFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/GotoTypeDefinitionFacts.cs @@ -426,7 +426,7 @@ public void Baz() { // second comment should indicate we have decompiled var comments = compilationUnit.DescendantTrivia().Where(t => t.IsKind(SyntaxKind.SingleLineCommentTrivia)).ToArray(); Assert.NotNull(comments); - Assert.Equal("// Decompiled with ICSharpCode.Decompiler 7.2.1.6856", comments[1].ToString()); + Assert.Equal("// Decompiled with ICSharpCode.Decompiler 8.2.0.7535", comments[1].ToString()); // contrary to regular metadata, we should have methods with full bodies // this condition would fail if decompilation wouldn't work diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/OmniSharp.Roslyn.CSharp.Tests.csproj b/tests/OmniSharp.Roslyn.CSharp.Tests/OmniSharp.Roslyn.CSharp.Tests.csproj index 4d96ac6112..3b23c45f77 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/OmniSharp.Roslyn.CSharp.Tests.csproj +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/OmniSharp.Roslyn.CSharp.Tests.csproj @@ -7,10 +7,6 @@ CS0618 - - - - diff --git a/tests/OmniSharp.Script.Tests/OmniSharp.Script.Tests.csproj b/tests/OmniSharp.Script.Tests/OmniSharp.Script.Tests.csproj index ef6b565d01..a80a60b605 100644 --- a/tests/OmniSharp.Script.Tests/OmniSharp.Script.Tests.csproj +++ b/tests/OmniSharp.Script.Tests/OmniSharp.Script.Tests.csproj @@ -6,10 +6,6 @@ true - - - - diff --git a/tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj b/tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj index 14828b8539..f9cec764d1 100644 --- a/tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj +++ b/tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj @@ -6,10 +6,6 @@ true - - - - diff --git a/tests/OmniSharp.Tests/CommandLineApplicationFacts.cs b/tests/OmniSharp.Tests/CommandLineApplicationFacts.cs index 5d75037bd3..5422d312eb 100644 --- a/tests/OmniSharp.Tests/CommandLineApplicationFacts.cs +++ b/tests/OmniSharp.Tests/CommandLineApplicationFacts.cs @@ -19,7 +19,7 @@ public void AllowsEqualsSignInSolutionPath(string arg1, string arg2, string arg3 { var app = new CommandLineApplication(); app.OnExecute(() => 0); - app.Execute(new[] { arg1, arg2, arg3 }); + app.Execute(new[] { arg1, arg2, arg3 }.OfType().ToArray()); Assert.Single(app.OtherArgs); Assert.Equal("a=b", app.OtherArgs.First()); diff --git a/tests/OmniSharp.Tests/DotNetCliServiceFacts.cs b/tests/OmniSharp.Tests/DotNetCliServiceFacts.cs index 4438a4afdf..d88c9a0017 100644 --- a/tests/OmniSharp.Tests/DotNetCliServiceFacts.cs +++ b/tests/OmniSharp.Tests/DotNetCliServiceFacts.cs @@ -7,7 +7,7 @@ namespace OmniSharp.Tests { public class DotNetCliServiceFacts : AbstractTestFixture { - private const string DotNetVersion = "8.0.100-rc.1.23463.5"; + private const string DotNetVersion = "8.0.100"; private int Major { get; } private int Minor { get; } private int Patch { get; } diff --git a/tests/OmniSharp.Tests/OmniSharp.Tests.csproj b/tests/OmniSharp.Tests/OmniSharp.Tests.csproj index 9e4305d39e..b29a508103 100644 --- a/tests/OmniSharp.Tests/OmniSharp.Tests.csproj +++ b/tests/OmniSharp.Tests/OmniSharp.Tests.csproj @@ -6,10 +6,6 @@ true - - - - diff --git a/tests/TestUtility/AssertEx.cs b/tests/TestUtility/AssertEx.cs index 966e93b23f..65dcd85517 100644 --- a/tests/TestUtility/AssertEx.cs +++ b/tests/TestUtility/AssertEx.cs @@ -202,7 +202,7 @@ public static void Equal(string expected, string actual) message.AppendLine("Actual:"); message.AppendLine(actual); - Assert.True(false, message.ToString()); + Assert.Fail(message.ToString()); } public static void Equal( @@ -236,7 +236,7 @@ public static void Equal( assertMessage = message + "\r\n" + assertMessage; } - Assert.True(false, assertMessage); + Assert.Fail(assertMessage); } /// @@ -278,7 +278,7 @@ public static void EqualOrDiff(string expected, string actual, string message = messageBuilder.AppendLine(line.Text); } - Assert.True(false, messageBuilder.ToString()); + Assert.Fail(messageBuilder.ToString()); } public static void NotEqual(IEnumerable expected, IEnumerable actual, IEqualityComparer comparer = null, string message = null, @@ -457,7 +457,7 @@ public static void SetEqual(IEnumerable actual, params T[] expected) if (!expectedSet.SetEquals(actual)) { var message = GetAssertMessage(ToString(expected, ",\r\n", itemInspector: withQuotes), ToString(actual, ",\r\n", itemInspector: withQuotes)); - Assert.True(false, message); + Assert.Fail(message); } string withQuotes(T t) => $"\"{Convert.ToString(t)}\""; @@ -535,7 +535,7 @@ public static void AssertEqualToleratingWhitespaceDifferences( if (normalizedExpected != normalizedActual) { - Assert.True(false, GetAssertMessage(expected, actual, escapeQuotes, expectedValueSourcePath, expectedValueSourceLine)); + Assert.Fail(GetAssertMessage(expected, actual, escapeQuotes, expectedValueSourcePath, expectedValueSourceLine)); } } @@ -561,7 +561,7 @@ public static void AssertResultsEqual(string result1, string result2) message = GetAssertMessage(result1, result2); } - Assert.True(false, message); + Assert.Fail(message); } } @@ -797,7 +797,7 @@ public static void Equal(T[,] expected, Func getResult, Func - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -