diff --git a/.cirrus.star b/.cirrus.star new file mode 100644 index 0000000000..af84e0a109 --- /dev/null +++ b/.cirrus.star @@ -0,0 +1,3 @@ +load("github.com/SonarSource/cirrus-modules@v3", "load_features") +def main(ctx): + return load_features(ctx) diff --git a/.cirrus.yaml b/.cirrus.yaml new file mode 100644 index 0000000000..dfab014f06 --- /dev/null +++ b/.cirrus.yaml @@ -0,0 +1,52 @@ +env: + # Allows to run builds for the 50 last commits in a branch: + CIRRUS_CLONE_DEPTH: 50 + CIRRUS_SHELL: bash + SLACK_TOKEN: VAULT[development/kv/data/slack data.token] + SLACK_CHANNEL: squad-ide-intellij-family-bots + +only_sonarsource_qa: &ONLY_SONARSOURCE_QA + only_if: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_TAG == "" && ($CIRRUS_PR != "" || $CIRRUS_BRANCH == "master" || $CIRRUS_BRANCH =~ "branch-.*" || $CIRRUS_BRANCH =~ "dogfood-on-.*") + +container_definition: &CONTAINER_DEFINITION + cluster_name: ${CIRRUS_CLUSTER_NAME} + region: eu-central-1 + dockerfile: .cirrus/Dockerfile + builder_role: cirrus-builder + builder_image: docker-builder-v* + builder_instance_type: t3.small + docker_arguments: + CIRRUS_AWS_ACCOUNT: ${CIRRUS_AWS_ACCOUNT} + +ec2_instance_definition: &INSTANCE_DEFINITION + region: eu-central-1 + type: c6i.xlarge + image: base-windows-dotnet-v* + platform: windows + +notify_slack_on_failure: &NOTIFY_SLACK_ON_FAILURE + on_failure: + slack_notification_script: source slack-failure-notification + +build_linux_task: + <<: *ONLY_SONARSOURCE_QA + eks_container: + <<: *CONTAINER_DEFINITION + cpu: 4 + memory: 4G + env: + PATH: ${PATH}:${HOME}/.dotnet/tools + CLR_OPENSSL_VERSION_OVERRIDE: "1.1" + build_linux_script: ./build.sh --target Quick --configuration Release + linux_artifacts: + path: artifacts/package/**/omnisharp-*.* + <<: *NOTIFY_SLACK_ON_FAILURE + +build_windows_task: + <<: *ONLY_SONARSOURCE_QA + ec2_instance: + <<: *INSTANCE_DEFINITION + build_windows_script: powershell -File build.ps1 -target Quick -configuration Release + windows_artifacts: + path: artifacts/package/**/omnisharp-*.* + <<: *NOTIFY_SLACK_ON_FAILURE diff --git a/.cirrus/Dockerfile b/.cirrus/Dockerfile new file mode 100644 index 0000000000..c5edb15349 --- /dev/null +++ b/.cirrus/Dockerfile @@ -0,0 +1,20 @@ +ARG CIRRUS_AWS_ACCOUNT +FROM ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest + +USER root +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y ca-certificates gnupg && \ + gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ + echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" > /etc/apt/sources.list.d/mono-official-stable.list && \ + apt-get update && \ + apt-get install -y \ + dotnet-sdk-8.0 \ + mono-complete \ + mono-roslyn \ + msbuild \ + && rm -rf /var/lib/apt/lists/* + +USER sonarsource +WORKDIR /home/sonarsource diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb7cf564de..103608c881 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,10 @@ name: 'Build' env: - DotNetVersion: "8.0.100-rc.1.23463.5" - DotNetVersion2: "7.0.302" - DotNetVersion3: "6.0.203" + DotNetVersion: "9.0.100-preview.6.24328.19" + DotNetVersion2: "8.0.303" + DotNetVersion3: "7.0.410" + DotNetVersion4: "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/ @@ -26,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2022, macos-11] + os: [ubuntu-20.04, windows-2022, macos-12] name: 'Build' steps: - name: Checkout @@ -52,6 +53,7 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | + ${{ env.DotNetVersion4 }} ${{ env.DotNetVersion3 }} ${{ env.DotNetVersion2 }} ${{ env.DotNetVersion }} diff --git a/.github/workflows/tests-net6.yml b/.github/workflows/tests-net6.yml index c3818e31cc..dd1abc62ab 100644 --- a/.github/workflows/tests-net6.yml +++ b/.github/workflows/tests-net6.yml @@ -1,9 +1,10 @@ name: 'Tests net6.0' env: - DotNetVersion: "8.0.100-rc.1.23463.5" - DotNetVersion2: "7.0.302" - DotNetVersion3: "6.0.203" + DotNetVersion: "9.0.100-preview.6.24328.19" + DotNetVersion2: "8.0.303" + DotNetVersion3: "7.0.410" + DotNetVersion4: "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/ @@ -26,10 +27,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2022, macos-11] + os: [ubuntu-20.04, windows-2022, macos-12] testProjects: - - OmniSharp.MSBuild.Tests,OmniSharp.Roslyn.CSharp.Tests,OmniSharp.Cake.Tests,OmniSharp.Script.Tests,OmniSharp.Stdio.Tests,OmniSharp.Http.Tests,OmniSharp.Tests,OmniSharp.Lsp.Tests - - OmniSharp.DotNetTest.Tests + - OmniSharp.MSBuild.Tests,OmniSharp.Roslyn.CSharp.Tests,OmniSharp.DotNetTest.Tests,OmniSharp.Cake.Tests + - OmniSharp.Lsp.Tests,OmniSharp.Script.Tests,OmniSharp.Tests,OmniSharp.Stdio.Tests,OmniSharp.Http.Tests name: 'Test' steps: - name: Checkout @@ -55,6 +56,7 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | + ${{ env.DotNetVersion4 }} ${{ env.DotNetVersion3 }} ${{ env.DotNetVersion2 }} ${{ env.DotNetVersion }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aea7444a09..97ff146410 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,9 +1,10 @@ name: 'Tests' env: - DotNetVersion: "8.0.100-rc.1.23463.5" - DotNetVersion2: "7.0.302" - DotNetVersion3: "6.0.203" + DotNetVersion: "9.0.100-preview.6.24328.19" + DotNetVersion2: "8.0.303" + DotNetVersion3: "7.0.410" + DotNetVersion4: "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/ @@ -26,10 +27,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2022, macos-11] + os: [ubuntu-20.04, windows-2022, macos-12] testProjects: - - OmniSharp.MSBuild.Tests,OmniSharp.Roslyn.CSharp.Tests,OmniSharp.Cake.Tests,OmniSharp.Script.Tests,OmniSharp.Stdio.Tests,OmniSharp.Http.Tests,OmniSharp.Tests,OmniSharp.Lsp.Tests - - OmniSharp.DotNetTest.Tests + - OmniSharp.MSBuild.Tests,OmniSharp.Roslyn.CSharp.Tests,OmniSharp.DotNetTest.Tests,OmniSharp.Cake.Tests + - OmniSharp.Lsp.Tests,OmniSharp.Script.Tests,OmniSharp.Tests,OmniSharp.Stdio.Tests,OmniSharp.Http.Tests name: 'Test' steps: - name: Checkout @@ -55,6 +56,7 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | + ${{ env.DotNetVersion4 }} ${{ env.DotNetVersion3 }} ${{ env.DotNetVersion2 }} ${{ env.DotNetVersion }} diff --git a/.pipelines/init.yml b/.pipelines/init.yml index 28f941900d..a44c330558 100644 --- a/.pipelines/init.yml +++ b/.pipelines/init.yml @@ -1,12 +1,10 @@ parameters: # Configuration: Release Verbosity: Normal - DotNetVersion: "8.0.100-rc.1.23463.5" - DotNetVersion2: "7.0.302" - DotNetVersion3: "6.0.203" + DotNetVersion: "8.0.201" CakeVersion: "1.1.0" NuGetVersion: "5.7.0" - MonoVersion: '' + MonoVersion: "" steps: - task: DownloadBuildArtifacts@0 displayName: "Download GitVersion Variables" @@ -17,31 +15,21 @@ steps: pipelineId: GitVersion targetPath: "$(Build.ArtifactStagingDirectory)/gitversion/" - task: RocketSurgeonsGuild.variable-tools.DeserializeVariables.DeserializeVariables@1 - displayName: 'Deserialize GitVersion' + displayName: "Deserialize GitVersion" inputs: jsonfiles: $(Build.ArtifactStagingDirectory)/gitversion/**/gitversion.json - task: UseDotNet@2 displayName: Install dotnet $(DotNetVersion) inputs: - packageType: 'sdk' + packageType: "sdk" version: ${{ parameters.DotNetVersion }} - - task: UseDotNet@2 - displayName: Install dotnet $(DotNetVersion2) - inputs: - packageType: 'sdk' - version: ${{ parameters.DotNetVersion2 }} - - task: UseDotNet@2 - displayName: Install dotnet $(DotNetVersion3) - inputs: - packageType: 'sdk' - version: ${{ parameters.DotNetVersion3 }} - task: DotNetCoreCLI@2 - displayName: 'dotnet install cake' + displayName: "dotnet install cake" inputs: command: custom custom: tool - arguments: 'install -g Cake.Tool --version $(CakeVersion)' - workingDirectory: '$(Build.ArtifactStagingDirectory)' + arguments: "install -g Cake.Tool --version $(CakeVersion)" + workingDirectory: "$(Build.ArtifactStagingDirectory)" env: CakeVersion: ${{ parameters.CakeVersion }} - task: NuGetToolInstaller@0 @@ -49,21 +37,21 @@ steps: inputs: versionSpec: ${{ parameters.NuGetVersion }} - task: NuGetCommand@2 - displayName: 'Cake restore packages.config' + displayName: "Cake restore packages.config" inputs: command: custom feedsToUse: config arguments: install tools/packages.config -ExcludeVersion -OutputDirectory tools - ${{ if ne(parameters.MonoVersion, '') }}: - - script: | - curl -o mono.pkg https://download.mono-project.com/archive/$MONO_VERSION/macos-10-universal/MonoFramework-MDK-$MONO_VERSION.182.macos10.xamarin.universal.pkg - sudo installer -pkg mono.pkg -target / - sudo cp -rf /Library/Frameworks/Mono.framework/Versions/$MONO_VERSION/ /Library/Frameworks/Mono.framework/Versions/Current/ - MONOPREFIX=/Library/Frameworks/Mono.framework/Versions/$MONO_VERSION - echo "##vso[task.setvariable variable=DYLD_FALLBACK_LIBRARY_PATH;]$MONOPREFIX/lib:/lib:/usr/lib:$DYLD_LIBRARY_FALLBACK_PATH" - echo "##vso[task.setvariable variable=PKG_CONFIG_PATH;]$MONOPREFIX/lib/pkgconfig:$MONOPREFIX/share/pkgconfig:$PKG_CONFIG_PATH" - echo "##vso[task.setvariable variable=PATH;]$MONOPREFIX/bin:$PATH" - env: - MONO_VERSION: ${{ parameters.MonoVersion }} - displayName: Use Mono ${{ parameters.MonoVersion }} - failOnStderr: false + - script: | + curl -o mono.pkg https://download.mono-project.com/archive/$MONO_VERSION/macos-10-universal/MonoFramework-MDK-$MONO_VERSION.182.macos10.xamarin.universal.pkg + sudo installer -pkg mono.pkg -target / + sudo cp -rf /Library/Frameworks/Mono.framework/Versions/$MONO_VERSION/ /Library/Frameworks/Mono.framework/Versions/Current/ + MONOPREFIX=/Library/Frameworks/Mono.framework/Versions/$MONO_VERSION + echo "##vso[task.setvariable variable=DYLD_FALLBACK_LIBRARY_PATH;]$MONOPREFIX/lib:/lib:/usr/lib:$DYLD_LIBRARY_FALLBACK_PATH" + echo "##vso[task.setvariable variable=PKG_CONFIG_PATH;]$MONOPREFIX/lib/pkgconfig:$MONOPREFIX/share/pkgconfig:$PKG_CONFIG_PATH" + echo "##vso[task.setvariable variable=PATH;]$MONOPREFIX/bin:$PATH" + env: + MONO_VERSION: ${{ parameters.MonoVersion }} + displayName: Use Mono ${{ parameters.MonoVersion }} + failOnStderr: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d38944c78..895af7e839 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,21 @@ # Changelog All changes to the project will be documented in this file. +## [1.39.12] - 2024-07-26 +* Update .NET SDKs (PR: [#2621](https://github.com/OmniSharp/omnisharp-roslyn/pull/2621)) +* Update Roslyn to 4.12.0-1.24358.3 (PR: [#2619](https://github.com/OmniSharp/omnisharp-roslyn/pull/2619)) +* Fix code fix construction (PR: [#2620](https://github.com/OmniSharp/omnisharp-roslyn/pull/2620)) +* Remove NuGet.Packaging.Core, as it's an assembly that only contains forwarders (PR: [#2610](https://github.com/OmniSharp/omnisharp-roslyn/pull/2610)) +* Fix inlay hints lambdas parameter type null reference exception (PR: [#2604](https://github.com/OmniSharp/omnisharp-roslyn/pull/2604)) +* Update SDKs and Roslyn (PR: [#2603](https://github.com/OmniSharp/omnisharp-roslyn/pull/2603)) +* Pass project path when performing a restore (PR: [#2593](https://github.com/OmniSharp/omnisharp-roslyn/pull/2593)) + +## [1.39.11] - 2023-12-19 +* Update changelog (PR: [#2591](https://github.com/OmniSharp/omnisharp-roslyn/pull/2591)) +* Update Readme text and fix broken link. ([#2581](https://github.com/OmniSharp/omnisharp-roslyn/issues/2581), PR: [#2582](https://github.com/OmniSharp/omnisharp-roslyn/pull/2582)) +* Update SDKs and dependencies ([#2586](https://github.com/OmniSharp/omnisharp-roslyn/issues/2586), PR: [#2588](https://github.com/OmniSharp/omnisharp-roslyn/pull/2588)) +* Updated to latest dotnet-script 1.5.0 (PR: [#2585](https://github.com/OmniSharp/omnisharp-roslyn/pull/2585)) + ## [1.39.10] - 2023-10-05 * Add RazorComplier EA to support razor generators (PR: [#2572](https://github.com/OmniSharp/omnisharp-roslyn/pull/2572)) diff --git a/Directory.Build.targets b/Directory.Build.targets index 4941558849..5275d9970c 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -8,7 +8,6 @@ - diff --git a/Directory.Packages.props b/Directory.Packages.props index f86f09ba49..35f2d16dd4 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.11.0-rc.110 + 4.12.0-1.24358.3 + 2.6.1 - - + + - + - + - + @@ -39,9 +39,9 @@ + - @@ -58,15 +58,12 @@ - + - - - @@ -74,7 +71,6 @@ - @@ -84,27 +80,26 @@ - - - - - + + + + + + - - + + + - - - - + - + 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/README.md b/README.md index a95ac4364b..3909f0e0a0 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ OmniSharp is a .NET development platform based on [Roslyn](https://github.com/dotnet/roslyn) workspaces. It provides project dependencies and C# language services to various IDEs and plugins. -OmniSharp is built with the [.NET Core SDK](https://dot.net/) on Windows and [Mono](http://www.mono-project.com/) on OSX/Linux. It targets the _net472_ target framework. For platforms other than Windows, OmniSharp ships with an _embedded Mono_ which is based on version _6.12.0_, includes MSBuild _16.8.0_ and is provisioned during the build script. If _Mono_ is globally installed on the system, OmniSharp will prefer it over the embedded version, however version _>=6.4.0_ is required (the lowest version with at least MSBuild _16.3.0_). +OmniSharp is built with the [.NET Core SDK](https://dot.net/) on Windows and [Mono](http://www.mono-project.com/) on OSX/Linux. It targets both the _net6.0_ and _net472_ target frameworks. The _net6.0_ build requires a .NET SDK version _>=6.0_. When using the _net472_ build on OSX/Linux, _Mono_ version _>=6.4.0_ is required and must be globally installed on the system. -For Arch Linux users, you need package [mono-msbuild](https://www.archlinux.org/packages/community/x86_64/mono-msbuild/) (>= 16.3). +For Arch Linux users, you need package [mono-msbuild](https://archlinux.org/packages/extra/x86_64/mono-msbuild/) (>= 16.3). In addition, if you need the HTTP interface and you want to run on Linux, you'll also need to make sure that you have [libuv](http://libuv.org) installed. See also https://github.com/OmniSharp/omnisharp-roslyn/issues/1202#issuecomment-421543905 . diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d2c4a20444..f9c32044cd 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.303" CakeVersion: "3.0.0" NuGetVersion: "6.5.0" GitVersionVersion: "5.0.1" @@ -55,7 +55,7 @@ jobs: - job: macOS pool: - vmImage: "macOS-11" + vmImage: "macos-12" dependsOn: GitVersion steps: - template: ./.pipelines/init.yml @@ -113,7 +113,7 @@ jobs: - job: Release pool: - vmImage: "Ubuntu-latest" + vmImage: "ubuntu-latest" dependsOn: - macOS - Linux diff --git a/build.cake b/build.cake index 345ef50754..1b7d040cb8 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,24 +155,22 @@ 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 + Verbosity = DotNetVerbosity.Minimal, }); - } catch { + } + catch when (project == "ExternAlias") + { // ExternalAlias has issues once in a while, try building again to get it working. - if (project == "ExternAlias") { - - DotNetBuild(folder, new DotNetBuildSettings() - { - ToolPath = env.DotNetCommand, - WorkingDirectory = folder, - Verbosity = DotNetVerbosity.Minimal - }); - } + DotNetBuild(folder, new DotNetBuildSettings() + { + WorkingDirectory = folder, + Verbosity = DotNetVerbosity.Minimal + }); } }); @@ -184,7 +184,6 @@ Task("PrepareTestAssets:RestoreOnlyTestAssets") DotNetRestore(new DotNetRestoreSettings() { - ToolPath = env.DotNetCommand, WorkingDirectory = folder, Verbosity = DotNetVerbosity.Minimal }); @@ -201,7 +200,6 @@ Task("PrepareTestAssets:WindowsOnlyTestAssets") DotNetBuild(folder, new DotNetBuildSettings() { - ToolPath = env.DotNetCommand, WorkingDirectory = folder, Verbosity = DotNetVerbosity.Minimal }); @@ -216,7 +214,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 +247,8 @@ void BuildWithDotNetCli(BuildEnvironment env, string configuration) }; settings.AddFileLogger( - new MSBuildFileLoggerSettings { + new MSBuildFileLoggerSettings + { AppendToLogFile = false, LogFile = logFileNameBase + ".log", ShowTimestamp = true, @@ -294,51 +294,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 ? "net8.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}"); + + Run("dotnet", arguments, instanceFolder) + .ExceptionOnError($"Test {testProject} failed for {testTargetFramework}"); + } + else + { + var logFile = CombinePaths(env.Folders.ArtifactsLogs, $"{testProject}-desktop-result.xml"); - Console.WriteLine($"Executing: dotnet {arguments}"); + // 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 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"); - } + // 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"); } } + } }); void CopyMonoMSBuildBinaries(string outputFolder) @@ -370,7 +370,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 +397,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 +444,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 +481,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); @@ -504,76 +515,25 @@ Task("PublishNet6Builds") { foreach (var project in buildPlan.HostProjects) { - if (publishAll) - { - if (Platform.Current.IsWindows) - { - PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net6.0"); - } - else if (Platform.Current.IsMacOS) - { - PublishBuild(project, env, buildPlan, configuration, "osx-x64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "osx-arm64", "net6.0"); - } - else - { - PublishBuild(project, env, buildPlan, configuration, "linux-x64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "linux-arm64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "linux-musl-x64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "linux-musl-arm64", "net6.0"); - } - } - else if (Platform.Current.IsWindows) - { - if (Platform.Current.IsX86) - { - PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net6.0"); - } - else if (Platform.Current.IsX64) - { - PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net6.0"); - } - else - { - PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net6.0"); - } - } - else - { - if (Platform.Current.IsMacOS) - { - PublishBuild(project, env, buildPlan, configuration, "osx-x64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "osx-arm64", "net6.0"); - } - else - { - PublishBuild(project, env, buildPlan, configuration, "linux-x64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "linux-arm64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "linux-musl-x64", "net6.0"); - PublishBuild(project, env, buildPlan, configuration, "linux-musl-arm64", "net6.0"); - } - } - + PublishBuild(project, env, buildPlan, configuration, "net6.0"); } }); -string PublishBuild(string project, BuildEnvironment env, BuildPlan plan, string configuration, string rid, string framework) +string PublishBuild(string project, BuildEnvironment env, BuildPlan plan, string configuration, string framework) { var projectName = project + ".csproj"; var projectFileName = CombinePaths(env.Folders.Source, project, projectName); - var outputFolder = CombinePaths(env.Folders.ArtifactsPublish, project, rid, framework); + var outputFolder = CombinePaths(env.Folders.ArtifactsPublish, project, framework); - Information("Publishing {0} for {1}...", projectName, rid); + Information("Publishing {0} for {1}...", projectName, framework); try { var publishSettings = new DotNetPublishSettings() { Framework = framework, - Runtime = rid, // TODO: With everything today do we need to publish this with a rid? This appears to be legacy bit when we used to push for all supported dotnet core rids. - PublishReadyToRun = true, // Improve startup performance by applying some AOT compilation + PublishReadyToRun = false, // Decrease size by NOT applying some AOT compilation + PublishTrimmed = false, // FIXME would be great to manage to trim SelfContained = false, // Since we are specifying a runtime identifier this defaults to true. We don't need to ship a runtime for net6 because we require the .NET SDK to be installed. Configuration = configuration, OutputDirectory = outputFolder, @@ -592,14 +552,14 @@ string PublishBuild(string project, BuildEnvironment env, BuildPlan plan, string } catch { - Error($"Failed to publish {project} for {rid}"); + Error($"Failed to publish {project} for {framework}"); throw; } CopyExtraDependencies(env, outputFolder); - AddOmniSharpBindingRedirects(outputFolder); + UpdateBindingRedirects(outputFolder); - var platformFolder = framework != "net472" ? $"{rid}-{framework}" : rid; + var platformFolder = $"{framework}"; Package(project, platformFolder, outputFolder, env.Folders.ArtifactsPackage, env.Folders.DeploymentPackage); return outputFolder; @@ -612,41 +572,16 @@ Task("PublishWindowsBuilds") { foreach (var project in buildPlan.HostProjects) { - string outputFolder; - - if (publishAll) - { - var outputFolderX86 = PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net472"); - var outputFolderX64 = PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net472"); - var outputFolderArm64 = PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net472"); - - outputFolder = Platform.Current.IsX86 - ? outputFolderX86 - : Platform.Current.IsX64 - ? outputFolderX64 - : outputFolderArm64; - } - else if (Platform.Current.IsX86) - { - outputFolder = PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net472"); - } - else if (Platform.Current.IsX64) - { - outputFolder = PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net472"); - } - else - { - outputFolder = PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net472"); - } - - CreateRunScript(project, outputFolder, env.Folders.ArtifactsScripts); + string outputFolder = PublishBuild(project, env, buildPlan, configuration, "net472"); } }); 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..380e357bfc 100644 --- a/build.json +++ b/build.json @@ -3,8 +3,9 @@ "DotNetChannel": "Preview", "DotNetVersions": [ "6.0.203", - "7.0.302", - "8.0.100-rc.1.23463.5" + "7.0.410", + "8.0.303", + "9.0.100-preview.6.24328.19" ], "RequiredMonoVersion": "6.6.0", "DownloadURL": "https://roslynomnisharp.blob.core.windows.net/ext", @@ -15,13 +16,13 @@ "TestProjects": [ "OmniSharp.MSBuild.Tests", "OmniSharp.Roslyn.CSharp.Tests", - "OmniSharp.Http.Tests", - "OmniSharp.Stdio.Tests", + "OmniSharp.Lsp.Tests", "OmniSharp.DotNetTest.Tests", - "OmniSharp.Tests", - "OmniSharp.Cake.Tests", "OmniSharp.Script.Tests", - "OmniSharp.Lsp.Tests" + "OmniSharp.Cake.Tests", + "OmniSharp.Http.Tests", + "OmniSharp.Stdio.Tests", + "OmniSharp.Tests" ], "TestAssets": [ "NUnitTestProject", 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..053d7733ad 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100-rc.1.23463.5", + "version": "8.0.108", "rollForward": "latestMinor" } } diff --git a/scripts/common.cake b/scripts/common.cake index b8053854a4..b4a3054471 100644 --- a/scripts/common.cake +++ b/scripts/common.cake @@ -283,10 +283,10 @@ public class BuildEnvironment return new GitVersion { - NuGetVersion = "0.0.1-local", - AssemblySemVer = "0.0.1.0", - InformationalVersion = "0.0.1-local", - SemVer = "0.0.1-local" + NuGetVersion = "1.39.12", + AssemblySemVer = "1.39.12.0", + InformationalVersion = "1.39.12", + SemVer = "1.39.12" }; } } diff --git a/src/OmniSharp.Abstractions/Configuration.cs b/src/OmniSharp.Abstractions/Configuration.cs index 1c5355f25a..3fd36a2469 100644 --- a/src/OmniSharp.Abstractions/Configuration.cs +++ b/src/OmniSharp.Abstractions/Configuration.cs @@ -4,7 +4,7 @@ internal static class Configuration { public static bool ZeroBasedIndices = false; - public const string RoslynVersion = "4.9.0.0"; + public const string RoslynVersion = "4.12.0.0"; public const string RoslynPublicKeyToken = "31bf3856ad364e35"; public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features"); diff --git a/src/OmniSharp.Benchmarks/OmniSharp.Benchmarks.csproj b/src/OmniSharp.Benchmarks/OmniSharp.Benchmarks.csproj index 90cfe1aa19..b3f2aa1753 100644 --- a/src/OmniSharp.Benchmarks/OmniSharp.Benchmarks.csproj +++ b/src/OmniSharp.Benchmarks/OmniSharp.Benchmarks.csproj @@ -5,6 +5,7 @@ net472 enable 9.0 + en diff --git a/src/OmniSharp.Cake/OmniSharp.Cake.csproj b/src/OmniSharp.Cake/OmniSharp.Cake.csproj index 55bbc19721..906ea9d7e6 100644 --- a/src/OmniSharp.Cake/OmniSharp.Cake.csproj +++ b/src/OmniSharp.Cake/OmniSharp.Cake.csproj @@ -3,6 +3,7 @@ net6.0;net472 AnyCPU + en diff --git a/src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj b/src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj index c28a9288d9..2f37621dff 100644 --- a/src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj +++ b/src/OmniSharp.DotNetTest/OmniSharp.DotNetTest.csproj @@ -3,6 +3,7 @@ net6.0;net472 AnyCPU + en @@ -18,7 +19,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..1da9ad2501 100644 --- a/src/OmniSharp.Host/OmniSharp.Host.csproj +++ b/src/OmniSharp.Host/OmniSharp.Host.csproj @@ -6,6 +6,7 @@ OmniSharp true true + en @@ -27,8 +28,6 @@ - - diff --git a/src/OmniSharp.Host/Services/DotNetCliService.cs b/src/OmniSharp.Host/Services/DotNetCliService.cs index d6c77c4389..4048d2a4ad 100644 --- a/src/OmniSharp.Host/Services/DotNetCliService.cs +++ b/src/OmniSharp.Host/Services/DotNetCliService.cs @@ -20,7 +20,7 @@ internal class DotNetCliService : IDotNetCliService private readonly ILogger _logger; private readonly IEventEmitter _eventEmitter; - private readonly ConcurrentDictionary _locks; + private readonly ConcurrentDictionary<(string WorkingDirectory, string Arguments), Task> _restoreTasks; private readonly SemaphoreSlim _semaphore; public string DotNetPath { get; } @@ -29,7 +29,7 @@ public DotNetCliService(ILoggerFactory loggerFactory, IEventEmitter eventEmitter { _logger = loggerFactory.CreateLogger(); _eventEmitter = eventEmitter; - _locks = new ConcurrentDictionary(); + _restoreTasks = new(); _semaphore = new SemaphoreSlim(Environment.ProcessorCount / 2); // Check if any of the provided paths have a dotnet executable. @@ -78,39 +78,42 @@ private static void RemoveMSBuildEnvironmentVariables(IDictionary { + var (workingDirectory, arguments) = key; + _logger.LogInformation($"Begin dotnet restore in '{workingDirectory}'"); - var restoreLock = _locks.GetOrAdd(workingDirectory, new object()); - lock (restoreLock) + var exitStatus = new ProcessExitStatus(-1); + _eventEmitter.RestoreStarted(workingDirectory); + _semaphore.Wait(); + try { - var exitStatus = new ProcessExitStatus(-1); - _eventEmitter.RestoreStarted(workingDirectory); - _semaphore.Wait(); - try - { - // A successful restore will update the project lock file which is monitored - // by the dotnet project system which eventually update the Roslyn model - exitStatus = ProcessHelper.Run(DotNetPath, $"restore {arguments}", workingDirectory, updateEnvironment: RemoveMSBuildEnvironmentVariables, - outputDataReceived: (data) => _logger.LogDebug(data), errorDataReceived: (data) => _logger.LogDebug(data)); - } - finally - { - _semaphore.Release(); - - _locks.TryRemove(workingDirectory, out _); + // A successful restore will update the project lock file which is monitored + // by the dotnet project system which eventually update the Roslyn model + exitStatus = ProcessHelper.Run(DotNetPath, $"restore {arguments}", workingDirectory, updateEnvironment: RemoveMSBuildEnvironmentVariables, + outputDataReceived: (data) => _logger.LogDebug(data), errorDataReceived: (data) => _logger.LogDebug(data)); + } + finally + { + _semaphore.Release(); - _eventEmitter.RestoreFinished(workingDirectory, exitStatus.Succeeded); + _restoreTasks.TryRemove(key, out _); - if (exitStatus.Failed && onFailure != null) - { - onFailure(); - } + _eventEmitter.RestoreFinished(workingDirectory, exitStatus.Succeeded); - _logger.LogInformation($"Finish restoring project {workingDirectory}. Exit code {exitStatus}"); + if (exitStatus.Failed && onFailure != null) + { + onFailure(); } + + _logger.LogInformation($"Finish restoring project {workingDirectory}. Exit code {exitStatus}"); } }); } diff --git a/src/OmniSharp.Http.Driver/OmniSharp.Http.Driver.csproj b/src/OmniSharp.Http.Driver/OmniSharp.Http.Driver.csproj index bb3945d3ef..0a4e4a5188 100644 --- a/src/OmniSharp.Http.Driver/OmniSharp.Http.Driver.csproj +++ b/src/OmniSharp.Http.Driver/OmniSharp.Http.Driver.csproj @@ -12,6 +12,7 @@ 6.0.0-preview.7.21317.1 LatestMajor true + en 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.Http/OmniSharp.Http.csproj b/src/OmniSharp.Http/OmniSharp.Http.csproj index e9586447ea..776c9c2103 100644 --- a/src/OmniSharp.Http/OmniSharp.Http.csproj +++ b/src/OmniSharp.Http/OmniSharp.Http.csproj @@ -3,6 +3,7 @@ net6.0;net472 AnyCPU + en diff --git a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpInlayHintHandler.cs b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpInlayHintHandler.cs index c3c831e61e..ce16575d73 100644 --- a/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpInlayHintHandler.cs +++ b/src/OmniSharp.LanguageServerProtocol/Handlers/OmniSharpInlayHintHandler.cs @@ -82,7 +82,7 @@ private static LSPInlayHint ToLSPInlayHint(OmniSharpInlayHint hint) ? new MarkupContent() { Kind = MarkupKind.Markdown, Value = hint.Tooltip } : null, Position = ToPosition(hint.Position), - TextEdits = new(ToTextEdits(hint.TextEdits)), + TextEdits = hint.TextEdits is not null ? new(ToTextEdits(hint.TextEdits)) : null, PaddingLeft = hint.Label.Length > trimmedStartLabel.Length, PaddingRight = trimmedStartLabel.Length > trimmedLabel.Length, Data = JToken.FromObject(hint.Data), diff --git a/src/OmniSharp.LanguageServerProtocol/OmniSharp.LanguageServerProtocol.csproj b/src/OmniSharp.LanguageServerProtocol/OmniSharp.LanguageServerProtocol.csproj index 3ba8f94765..90bb3c9056 100644 --- a/src/OmniSharp.LanguageServerProtocol/OmniSharp.LanguageServerProtocol.csproj +++ b/src/OmniSharp.LanguageServerProtocol/OmniSharp.LanguageServerProtocol.csproj @@ -10,6 +10,7 @@ 6.0.0-preview.7.21317.1 LatestMajor + en 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.MSBuild/OmniSharp.MSBuild.csproj b/src/OmniSharp.MSBuild/OmniSharp.MSBuild.csproj index 3581e6dbad..4f45d4c102 100644 --- a/src/OmniSharp.MSBuild/OmniSharp.MSBuild.csproj +++ b/src/OmniSharp.MSBuild/OmniSharp.MSBuild.csproj @@ -5,6 +5,7 @@ AnyCPU true true + en @@ -19,7 +20,6 @@ - diff --git a/src/OmniSharp.MSBuild/PackageDependencyChecker.cs b/src/OmniSharp.MSBuild/PackageDependencyChecker.cs index a7ae60d2ed..b8ec61d275 100644 --- a/src/OmniSharp.MSBuild/PackageDependencyChecker.cs +++ b/src/OmniSharp.MSBuild/PackageDependencyChecker.cs @@ -45,7 +45,7 @@ public void CheckForUnresolvedDependences(ProjectFileInfo projectFile, bool allo if (allowAutoRestore && _options.EnablePackageAutoRestore) { - _dotNetCli.RestoreAsync(projectFile.Directory, onFailure: () => + _dotNetCli.RestoreAsync(projectFile.Directory, projectFile.FilePath, onFailure: () => { _eventEmitter.UnresolvedDepdendencies(projectFile.FilePath, unresolvedDependencies); }); diff --git a/src/OmniSharp.Plugins/OmniSharp.Plugins.csproj b/src/OmniSharp.Plugins/OmniSharp.Plugins.csproj index aa0ecda69b..17886ef8e4 100644 --- a/src/OmniSharp.Plugins/OmniSharp.Plugins.csproj +++ b/src/OmniSharp.Plugins/OmniSharp.Plugins.csproj @@ -3,6 +3,7 @@ net472 AnyCPU + en diff --git a/src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj b/src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj index 004dc8fc5b..72a518cfe4 100644 --- a/src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj +++ b/src/OmniSharp.Roslyn.CSharp/OmniSharp.Roslyn.CSharp.csproj @@ -5,6 +5,7 @@ AnyCPU true true + en diff --git a/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/BaseCodeActionService.cs b/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/BaseCodeActionService.cs index afd8544778..7e6f996b54 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/BaseCodeActionService.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/BaseCodeActionService.cs @@ -227,7 +227,7 @@ private IEnumerable ConvertToAvailableCodeAction(IEnumerabl { return actions.SelectMany(action => { - var nestedActions = action.CodeAction.GetNestedCodeActions(); + var nestedActions = action.CodeAction.NestedActions; if (!nestedActions.IsDefaultOrEmpty) { return nestedActions.Select(nestedAction => new AvailableCodeAction(nestedAction, action.CodeActionKind, action.CodeAction)); diff --git a/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/CachingCodeFixProviderForProjects.cs b/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/CachingCodeFixProviderForProjects.cs index ea230f0a16..f5ad4df1cc 100644 --- a/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/CachingCodeFixProviderForProjects.cs +++ b/src/OmniSharp.Roslyn.CSharp/Services/Refactoring/V2/CachingCodeFixProviderForProjects.cs @@ -61,30 +61,30 @@ private ImmutableArray LoadFrom(Project project) { var codeFixesFromProjectReferences = project.AnalyzerReferences .OfType() - .SelectMany(analyzerFileReference => analyzerFileReference.GetAssembly().DefinedTypes) + .SelectMany(analyzerFileReference => GetConcreteTypes(analyzerFileReference.GetAssembly())) .Where(x => !x.IsAbstract && x.IsSubclassOf(typeof(CodeFixProvider))) .Select(x => { try { - var attribute = x.GetCustomAttribute(); + var attribute = x.GetCustomAttribute(inherit: false); if (attribute == null) { - _logger.LogTrace($"Skipping code fix provider '{x.AsType()}' because it is missing the ExportCodeFixProviderAttribute."); + _logger.LogTrace($"Skipping code fix provider '{x}' because it is missing the ExportCodeFixProviderAttribute."); return null; } if (attribute.Languages == null || !attribute.Languages.Contains(project.Language)) { - _logger.LogInformation($"Skipping code fix provider '{x.AsType()}' because its language '{attribute.Languages?.FirstOrDefault()}' doesn't match '{project.Language}'."); + _logger.LogInformation($"Skipping code fix provider '{x}' because its language '{attribute.Languages?.FirstOrDefault()}' doesn't match '{project.Language}'."); return null; } - return x.AsType().CreateInstance(); + return (CodeFixProvider)Activator.CreateInstance(x); } catch (Exception ex) { - _logger.LogError($"Creating instance of code fix provider '{x.AsType()}' failed, error: {ex}"); + _logger.LogError($"Creating instance of code fix provider '{x}' failed, error: {ex}"); return null; } }) @@ -98,5 +98,25 @@ private ImmutableArray LoadFrom(Project project) return allCodeFixes; } + + private IEnumerable GetConcreteTypes(Assembly assembly) + { + try + { + var concreteTypes = assembly + .GetTypes() + .Where(type => !type.GetTypeInfo().IsInterface + && !type.GetTypeInfo().IsAbstract + && !type.GetTypeInfo().ContainsGenericParameters); + + // Realize the collection to ensure exceptions are caught + return concreteTypes.ToList(); + } + catch (Exception ex) + { + _logger.LogError($"Getting concrete types from assembly '{assembly}' failed, error: {ex}"); + return Type.EmptyTypes; + } + } } } diff --git a/src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj b/src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj index 5de02185b1..099d010c50 100644 --- a/src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj +++ b/src/OmniSharp.Roslyn/OmniSharp.Roslyn.csproj @@ -5,6 +5,7 @@ AnyCPU true true + en @@ -16,10 +17,12 @@ - - - + + + + + diff --git a/src/OmniSharp.Script/OmniSharp.Script.csproj b/src/OmniSharp.Script/OmniSharp.Script.csproj index 688566d94c..bf693d2967 100644 --- a/src/OmniSharp.Script/OmniSharp.Script.csproj +++ b/src/OmniSharp.Script/OmniSharp.Script.csproj @@ -3,6 +3,7 @@ net6.0;net472 AnyCPU + en diff --git a/src/OmniSharp.Shared/OmniSharp.Shared.csproj b/src/OmniSharp.Shared/OmniSharp.Shared.csproj index 2c111b148d..ec478c49a5 100644 --- a/src/OmniSharp.Shared/OmniSharp.Shared.csproj +++ b/src/OmniSharp.Shared/OmniSharp.Shared.csproj @@ -6,6 +6,7 @@ OmniSharp true true + en diff --git a/src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj b/src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj index aa80b2c2c5..86f2f37aac 100644 --- a/src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj +++ b/src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj @@ -12,6 +12,7 @@ 6.0.0-preview.7.21317.1 LatestMajor true + en 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/src/OmniSharp.Stdio/OmniSharp.Stdio.csproj b/src/OmniSharp.Stdio/OmniSharp.Stdio.csproj index 038f3fb55d..63d54a7fd5 100644 --- a/src/OmniSharp.Stdio/OmniSharp.Stdio.csproj +++ b/src/OmniSharp.Stdio/OmniSharp.Stdio.csproj @@ -3,6 +3,7 @@ net6.0;net472 AnyCPU + en diff --git a/test-assets/test-projects/Net70Project/global.json b/test-assets/test-projects/Net70Project/global.json index e7a6251dc2..f86bc2f847 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.410" } -} \ 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..4ce8f1ee66 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.303" } } \ No newline at end of file diff --git a/test-assets/test-projects/Net90Project/Net90Project.csproj b/test-assets/test-projects/Net90Project/Net90Project.csproj new file mode 100644 index 0000000000..92e46ddacc --- /dev/null +++ b/test-assets/test-projects/Net90Project/Net90Project.csproj @@ -0,0 +1,8 @@ + + + + Exe + net9.0 + + + diff --git a/test-assets/test-projects/Net90Project/Program.cs b/test-assets/test-projects/Net90Project/Program.cs new file mode 100644 index 0000000000..dbae8113d5 --- /dev/null +++ b/test-assets/test-projects/Net90Project/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ProjectAndSolution +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/test-assets/test-projects/Net90Project/global.json b/test-assets/test-projects/Net90Project/global.json new file mode 100644 index 0000000000..d2da1deed6 --- /dev/null +++ b/test-assets/test-projects/Net90Project/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "9.0.100-preview.6.24328.19" + } +} \ No newline at end of file diff --git a/test-assets/test-projects/ProjectWithWildcardPackageReference/ProjectWithWildcardPackageReference.csproj b/test-assets/test-projects/ProjectWithWildcardPackageReference/ProjectWithWildcardPackageReference.csproj index 7f59cc13e3..acacc9b4da 100644 --- a/test-assets/test-projects/ProjectWithWildcardPackageReference/ProjectWithWildcardPackageReference.csproj +++ b/test-assets/test-projects/ProjectWithWildcardPackageReference/ProjectWithWildcardPackageReference.csproj @@ -7,7 +7,7 @@ - + diff --git a/tests/OmniSharp.Cake.Tests/BlockStructureFacts.cs b/tests/OmniSharp.Cake.Tests/BlockStructureFacts.cs index a170950055..9dfd9d1ab3 100644 --- a/tests/OmniSharp.Cake.Tests/BlockStructureFacts.cs +++ b/tests/OmniSharp.Cake.Tests/BlockStructureFacts.cs @@ -38,7 +38,9 @@ void M()[| .ToArray(); var expected = testFile.Content.GetSpans() - .Select(span => testFile.Content.GetRangeFromSpan(span).ToRange()).ToArray(); + .Select(span => testFile.Content.GetRangeFromSpan(span).ToRange()) + .Reverse() + .ToArray(); Assert.Equal(expected, lineSpans); } diff --git a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj index 1ef6ceb217..e4d1b86590 100644 --- a/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj +++ b/tests/OmniSharp.Cake.Tests/OmniSharp.Cake.Tests.csproj @@ -1,7 +1,7 @@ - net7.0;net472 + net8.0;net472 AnyCPU true @@ -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..9e1f3a508d 100644 --- a/tests/OmniSharp.DotNetTest.Tests/OmniSharp.DotNetTest.Tests.csproj +++ b/tests/OmniSharp.DotNetTest.Tests/OmniSharp.DotNetTest.Tests.csproj @@ -1,15 +1,11 @@  - net7.0;net472 + net8.0;net472 AnyCPU 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..c96aa05f91 100644 --- a/tests/OmniSharp.Http.Tests/OmniSharp.Http.Tests.csproj +++ b/tests/OmniSharp.Http.Tests/OmniSharp.Http.Tests.csproj @@ -1,15 +1,11 @@  - net7.0;net472 + net8.0;net472 AnyCPU 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..f755678976 100644 --- a/tests/OmniSharp.Lsp.Tests/OmniSharp.Lsp.Tests.csproj +++ b/tests/OmniSharp.Lsp.Tests/OmniSharp.Lsp.Tests.csproj @@ -1,15 +1,11 @@  - net7.0;net472 + net8.0;net472 AnyCPU true - - - - diff --git a/tests/OmniSharp.Lsp.Tests/OmniSharpInlayHintHandlerFacts.cs b/tests/OmniSharp.Lsp.Tests/OmniSharpInlayHintHandlerFacts.cs index 904992d23d..ba5a3a6a44 100644 --- a/tests/OmniSharp.Lsp.Tests/OmniSharpInlayHintHandlerFacts.cs +++ b/tests/OmniSharp.Lsp.Tests/OmniSharpInlayHintHandlerFacts.cs @@ -156,6 +156,43 @@ public async Task InlayHintsForVarTypes(string fileName) } } + [Theory] + [InlineData("dummy.cs")] + [InlineData("dummy.csx")] + public async Task InlayHintsForLambdaParameterTypeNearFunctionParameterName(string fileName) + { + var code = @" +using System; +void fun(Func lambda) {} +{|ihRegion:fun(b => true);|} +"; + + var options = InlayHintsOptions.AllOn with { ForLambdaParameterTypes = false }; + + { + await SetInlayHintOptionsAsync(options); + var response = await GetInlayHints(fileName, code); + AssertEx.Equal(new[] + { + new InlayHint { Position = new Position { Line = 3, Character = 4 }, Label = "lambda:", Kind = InlayHintKind.Parameter, Tooltip = null, TextEdits = new[] { new TextEdit { Range = new Range() { Start = new Position() { Line = 3, Character = 4 }, End = new Position() { Line = 3, Character = 4 } }, NewText = "lambda: " } }, PaddingLeft = false, PaddingRight = true }, + }, + response, + ignoreDataComparer); + } + + { + await SetInlayHintOptionsAsync(options with { ForLambdaParameterTypes = true }); + var response = await GetInlayHints(fileName, code); + AssertEx.Equal(new[] + { + new InlayHint { Position = new Position { Line = 3, Character = 4 }, Label = "lambda:", Kind = InlayHintKind.Parameter, Tooltip = null, TextEdits = new[] { new TextEdit { Range = new Range() { Start = new Position() { Line = 3, Character = 4 }, End = new Position() { Line = 3, Character = 4 } }, NewText = "lambda: " } }, PaddingLeft = false, PaddingRight = true }, + new InlayHint { Position = new Position { Line = 3, Character = 4 }, Label = "int", Kind = InlayHintKind.Type, Tooltip = null, TextEdits = null, PaddingLeft = false, PaddingRight = true }, + }, + response, + ignoreDataComparer); + } + } + [Theory] [InlineData("dummy.cs")] [InlineData("dummy.csx")] 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.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs b/tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs index e9ad524bce..c2caf0ac96 100644 --- a/tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs +++ b/tests/OmniSharp.Lsp.Tests/OmnisharpCompletionHandlerFacts.cs @@ -1561,11 +1561,18 @@ private async Task FindCompletionsWithImportedAsync(string filen return completions; } - // Populating the completion list should take no more than a few ms, don't let it take too + // Populating the completion cache should take no more than a few ms, don't let it take too // long - await Task.Delay(ImportCompletionTimeout); - - completions = await FindCompletionsAsync(filename, source); + CancellationTokenSource cts = new CancellationTokenSource(millisecondsDelay: ImportCompletionTimeout); + await Task.Run(async () => + { + while (completions.IsIncomplete) + { + await Task.Delay(100); + completions = await FindCompletionsAsync(filename, source); + cts.Token.ThrowIfCancellationRequested(); + } + }, cts.Token); Assert.False(completions.IsIncomplete); return completions; 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..cd98225368 100644 --- a/tests/OmniSharp.MSBuild.Tests/OmniSharp.MSBuild.Tests.csproj +++ b/tests/OmniSharp.MSBuild.Tests/OmniSharp.MSBuild.Tests.csproj @@ -1,15 +1,11 @@  - net7.0;net472 + net8.0;net472 AnyCPU true - - - - diff --git a/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs b/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs index 6a35385019..2736647e7e 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.410"), emitter.ReceivedMessages[0].SdkVersion); } [ConditionalFact(typeof(DotnetRuntimeOnly))] @@ -243,7 +243,19 @@ 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.303"), emitter.ReceivedMessages[0].SdkVersion); + } + + [ConditionalFact(typeof(DotnetRuntimeOnly))] + public async Task The_correct_sdk_version_is_emitted_NET9() + { + // Arrange + var emitter = new ProjectLoadTestEventEmitter(); + + using var testProject = await TestAssets.Instance.GetTestProjectAsync("Net90Project"); + using var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory)); + Assert.Single(emitter.ReceivedMessages); + Assert.Equal(GetHashedFileExtension("9.0.100-preview.6.24328.19"), emitter.ReceivedMessages[0].SdkVersion); } private string GetHashedFileExtension(string fileExtension) diff --git a/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs b/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs index d6a9b8d879..8022711017 100644 --- a/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs +++ b/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs @@ -114,6 +114,34 @@ public async Task Net70Project() Assert.Contains(project.TargetFrameworks[0].ShortName, new[] { "net70", "net7.0" }); } + [ConditionalFact(typeof(NonMonoRuntimeOnly))] + public async Task Net80Project() + { + using var testProject = await TestAssets.Instance.GetTestProjectAsync("Net80Project"); + using var host = CreateMSBuildTestHost(testProject.Directory); + var workspaceInfo = await host.RequestMSBuildWorkspaceInfoAsync(); + + Assert.NotNull(workspaceInfo.Projects); + var project = Assert.Single(workspaceInfo.Projects); + Assert.Equal("Net80Project", project.AssemblyName); + Assert.Equal(".NETCoreApp,Version=v8.0", project.TargetFramework); + Assert.Contains(project.TargetFrameworks[0].ShortName, new[] { "net80", "net8.0" }); + } + + [ConditionalFact(typeof(NonMonoRuntimeOnly))] + public async Task Net90Project() + { + using var testProject = await TestAssets.Instance.GetTestProjectAsync("Net90Project"); + using var host = CreateMSBuildTestHost(testProject.Directory); + var workspaceInfo = await host.RequestMSBuildWorkspaceInfoAsync(); + + Assert.NotNull(workspaceInfo.Projects); + var project = Assert.Single(workspaceInfo.Projects); + Assert.Equal("Net90Project", project.AssemblyName); + Assert.Equal(".NETCoreApp,Version=v9.0", project.TargetFramework); + Assert.Contains(project.TargetFrameworks[0].ShortName, new[] { "net79", "net9.0" }); + } + [Fact] public async Task TwoProjectsWithSolution() { 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/BlockStructureFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/BlockStructureFacts.cs index 2579e0baba..e4e165adeb 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/BlockStructureFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/BlockStructureFacts.cs @@ -37,7 +37,9 @@ void M()[| .ToArray(); var expected = testFile.Content.GetSpans() - .Select(span => testFile.Content.GetRangeFromSpan(span).ToRange()).ToArray(); + .Select(span => testFile.Content.GetRangeFromSpan(span).ToRange()) + .Reverse() + .ToArray(); Assert.Equal(expected, lineSpans); } 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..fb56a8dc38 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/OmniSharp.Roslyn.CSharp.Tests.csproj +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/OmniSharp.Roslyn.CSharp.Tests.csproj @@ -1,16 +1,12 @@  - net7.0;net472 + net8.0;net472 AnyCPU true CS0618 - - - - diff --git a/tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs b/tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs index 28863d82f9..f0526bbeea 100644 --- a/tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs +++ b/tests/OmniSharp.Roslyn.CSharp.Tests/QuickInfoProviderFacts.cs @@ -196,7 +196,7 @@ public async Task DisplayFormatForMethodSymbol_Invocation() var response = await GetTypeLookUpResponse(line: 6, column: 35); #if NETCOREAPP - Assert.Equal("```csharp\nvoid Console.WriteLine(string? value) (+ 17 overloads)\n```", response.Markdown); + Assert.Equal("```csharp\nvoid Console.WriteLine(string? value) (+ 18 overloads)\n```", response.Markdown); #else Assert.Equal("```csharp\nvoid Console.WriteLine(string value) (+ 18 overloads)\n```", response.Markdown); #endif diff --git a/tests/OmniSharp.Script.Tests/OmniSharp.Script.Tests.csproj b/tests/OmniSharp.Script.Tests/OmniSharp.Script.Tests.csproj index ef6b565d01..4ca199f0e8 100644 --- a/tests/OmniSharp.Script.Tests/OmniSharp.Script.Tests.csproj +++ b/tests/OmniSharp.Script.Tests/OmniSharp.Script.Tests.csproj @@ -1,15 +1,11 @@ - net7.0;net472 + net8.0;net472 AnyCPU true - - - - diff --git a/tests/OmniSharp.Script.Tests/ScriptProjectProviderTests.cs b/tests/OmniSharp.Script.Tests/ScriptProjectProviderTests.cs index d71165b28c..92fd268ed6 100644 --- a/tests/OmniSharp.Script.Tests/ScriptProjectProviderTests.cs +++ b/tests/OmniSharp.Script.Tests/ScriptProjectProviderTests.cs @@ -17,7 +17,7 @@ public void DefaultLanguageVersionShouldBeLatest() var scriptProjectProvider = new ScriptProjectProvider(new ScriptOptions(), new OmniSharpEnvironment(), new LoggerFactory(), true, false); var scriptProjectInfo = scriptProjectProvider.CreateProject("test.csx", Enumerable.Empty(), Path.GetTempPath(), typeof(CommandLineScriptGlobals)); Assert.Equal(LanguageVersion.Latest, ((CSharpParseOptions)scriptProjectInfo.ParseOptions).SpecifiedLanguageVersion); - Assert.Equal(LanguageVersion.CSharp12, ((CSharpParseOptions)scriptProjectInfo.ParseOptions).LanguageVersion); + Assert.Equal(LanguageVersion.CSharp13, ((CSharpParseOptions)scriptProjectInfo.ParseOptions).LanguageVersion); } } } diff --git a/tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj b/tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj index 14828b8539..6a77fb4db2 100644 --- a/tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj +++ b/tests/OmniSharp.Stdio.Tests/OmniSharp.Stdio.Tests.csproj @@ -1,15 +1,11 @@  - net7.0;net472 + net8.0;net472 AnyCPU 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..ef5c41f2ef 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.303"; 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..b668f9d085 100644 --- a/tests/OmniSharp.Tests/OmniSharp.Tests.csproj +++ b/tests/OmniSharp.Tests/OmniSharp.Tests.csproj @@ -1,15 +1,11 @@  - net7.0;net472 + net8.0;net472 AnyCPU 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 - net7.0;net472 + net8.0;net472 AnyCPU diff --git a/tests/app.config b/tests/app.config deleted file mode 100644 index 3572a346cc..0000000000 --- a/tests/app.config +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/packages.config b/tools/packages.config index 1da49565b7..ce93b9a314 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -3,7 +3,7 @@ - +