Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update Roslyn to 4.5.0-2.22527.10 #2486

Merged
merged 9 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All changes to the project will be documented in this file.

## [1.39.3]
* Update Roslyn to 4.5.0-2.22527.10 (PR: [#2486](https://github.com/OmniSharp/omnisharp-roslyn/pull/2486))

## [1.39.2] - 2022-10-26
* Add missing LSP Handlers (PR: [#2463](https://github.com/OmniSharp/omnisharp-roslyn/pull/2463))
* Add the TypeDefinitionHandler to the LSP (PR: [#2461](https://github.com/OmniSharp/omnisharp-roslyn/pull/2461))
Expand Down
14 changes: 10 additions & 4 deletions build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<MicrosoftTestPackageVersion>17.3.0</MicrosoftTestPackageVersion>
<MSBuildPackageVersion>17.3.1</MSBuildPackageVersion>
<NuGetPackageVersion>6.4.0-preview.1.53</NuGetPackageVersion>
<RoslynPackageVersion>4.4.0-3.22429.3</RoslynPackageVersion>
<RoslynPackageVersion>4.5.0-2.22527.10</RoslynPackageVersion>
<XunitPackageVersion>2.4.1</XunitPackageVersion>
</PropertyGroup>

Expand Down Expand Up @@ -59,6 +59,12 @@
<PackageReference Update="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.14.114" />
<PackageReference Update="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.12" />

<!-- The two references below can be deleted once OmniSharp.Extensions.LanguageServer
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O#-roslyn and Razor both indirectly reference Microsoft.VisualStudio.Validation:

  • O#-roslyn via OmniSharp.Extensions.LanguageServer -> OmniSharp.Extensions.JsonRpc -> Nerdbank.Streams -> Microsoft.VisualStudio.Threading -> Microsoft.VisualStudio.Validation
  • Razor via Microsoft.VisualStudio.Threading -> Microsoft.VisualStudio.Validation

Razor is on a 17.xx version of Microsoft.VisualStudio.Validation, while O#-roslyn is on a lower version. We need to bump O#-roslyn's version to avoid errors in Razor files. However, the newest version of OmniSharp.Extensions.LanguageServer only utilizes a Validation version of 16.xx, so we have to bump explicitly until they update to a newer version.

references Nerdbank.Streams version >= 2.9. The updated versions are needed for compatibility
with Razor. -->
<PackageReference Update="Microsoft.VisualStudio.Threading" Version="17.4.27" />
<PackageReference Update="Microsoft.VisualStudio.Validation" Version="17.0.64" />

<PackageReference Update="Newtonsoft.Json" Version="13.0.1" />

<PackageReference Update="NuGet.Common" Version="$(NuGetPackageVersion)" />
Expand All @@ -72,10 +78,10 @@
<PackageReference Update="NuGet.Protocol" Version="$(NuGetPackageVersion)" />
<PackageReference Update="NuGet.Versioning" Version="$(NuGetPackageVersion)" />

<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.19.0" />
<PackageReference Update="OmniSharp.Extensions.LanguageProtocol.Testing" Version="0.19.0" />
<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.19.7" />
<PackageReference Update="OmniSharp.Extensions.LanguageProtocol.Testing" Version="0.19.7" />

<PackageReference Update="SQLitePCLRaw.bundle_green" Version="2.0.7" />
<PackageReference Update="SQLitePCLRaw.bundle_green" Version="2.1.0" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was seeing build warnings until I bumped this version

<PackageReference Update="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Update="System.ComponentModel.Composition" Version="4.5.0" />
<PackageReference Update="System.Composition" Version="6.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.Abstractions/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ internal static class Configuration
{
public static bool ZeroBasedIndices = false;

public const string RoslynVersion = "4.4.0.0";
public const string RoslynVersion = "4.5.0.0";
public const string RoslynPublicKeyToken = "31bf3856ad364e35";

public readonly static string RoslynFeatures = GetRoslynAssemblyFullName("Microsoft.CodeAnalysis.Features");
Expand Down
12 changes: 6 additions & 6 deletions src/OmniSharp.Http.Driver/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down Expand Up @@ -65,7 +65,7 @@

<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<!-- System.Memory assembly version does not align with the NuGet package version.
<!-- System.Memory assembly version does not align with the NuGet package version.
Package version 4.5.5 ships with assembly version 4.0.1.2 -->
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
<PackageReference Include="OmniSharp.Extensions.LanguageServer" />

<!-- The two references below can be deleted once OmniSharp.Extensions.LanguageServer
references Nerdbank.Streams version >= 2.9. The updated versions are needed for compatibility
with Razor. -->
<PackageReference Include="Microsoft.VisualStudio.Threading" />
<PackageReference Include="Microsoft.VisualStudio.Validation" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/OmniSharp.LanguageServerProtocol/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ internal static partial class CompletionListBuilder
internal const string XmlDocCommentCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.XmlDocCommentCompletionProvider";
internal const string TypeImportCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.TypeImportCompletionProvider";
internal const string ExtensionMethodImportCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.ExtensionMethodImportCompletionProvider";
internal const string AggregateEmeddedLanguageCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.AggregateEmbeddedLanguageCompletionProvider";
internal const string AggregateEmbeddedLanguageCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.Providers.AggregateEmbeddedLanguageCompletionProvider";
internal const string SnippetCompletionProvider = "Microsoft.CodeAnalysis.CSharp.Completion.CompletionProviders.Snippets.CSharpSnippetCompletionProvider";

internal static async Task<(IReadOnlyList<CompletionItem>, bool)> BuildCompletionItems(
Document document,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ internal static partial class CompletionListBuilder
bool hasAfterInsertStep = false;
if (completion.IsComplexTextEdit)
{
// The completion is somehow expensive. Currently, this one of two categories: import completion, or override/partial
// completion.
// To-do: Add support for snippet items: https://github.com/OmniSharp/omnisharp-roslyn/issues/2485
if (completion.GetProviderName() == SnippetCompletionProvider)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including snippets seems to be causing duplicate items in the completion list, so skipping for now.

{
continue;
}

// The completion is somehow expensive. Currently, this one of two categories: import completion or override/partial completion.
Debug.Assert(completion.GetProviderName() is OverrideCompletionProvider or PartialMethodCompletionProvider
or TypeImportCompletionProvider or ExtensionMethodImportCompletionProvider
or AwaitCompletionProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static AutoCompleteResponse ToAutoCompleteResponse(this CompletionItem it

// if provider name is "Microsoft.CodeAnalysis.CSharp.Completion.Providers.EmbeddedLanguageCompletionProvider"
// we have access to more elaborate description
if (item.GetProviderName() == CompletionListBuilder.AggregateEmeddedLanguageCompletionProvider)
if (item.GetProviderName() == CompletionListBuilder.AggregateEmbeddedLanguageCompletionProvider)
{
response.DisplayText = item.InlineDescription;
if (item.Properties.TryGetValue("DescriptionKey", out var description))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public async Task<SourceGeneratedFileResponse> Handle(SourceGeneratedFileRequest

var text = await document.GetTextAsync();

var documentVerison = await document.GetTextVersionAsync();
var documentVersion = await document.GetTextVersionAsync();
lock (_lock)
{
_lastSentVerisons[documentId] = documentVerison;
_lastSentVerisons[documentId] = documentVersion;
}

return new SourceGeneratedFileResponse
Expand Down
12 changes: 6 additions & 6 deletions src/OmniSharp.Stdio.Driver/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down Expand Up @@ -65,7 +65,7 @@

<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<!-- System.Memory assembly version does not align with the NuGet package version.
<!-- System.Memory assembly version does not align with the NuGet package version.
Package version 4.5.5 ships with assembly version 4.0.1.2 -->
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using OmniSharp.Models.Diagnostics;
using OmniSharp.MSBuild;
using OmniSharp.Roslyn.CSharp.Services.Diagnostics;
using TestUtility;
using Xunit;
using Xunit.Abstractions;
Expand Down Expand Up @@ -211,7 +209,7 @@ public async Task When_custom_rule_is_set_to_none_dont_return_results_at_all()
}
}

[Fact]
[Fact(Skip = "https://github.com/dotnet/roslyn/issues/66085")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The underlying issue here has been fixed (thanks Manish!), however the fix is in a newer version of Roslyn, so skipping the test for now

public async Task When_diagnostic_is_disabled_by_default_updating_rule_will_enable_it()
{
using (var host = GetHost())
Expand Down
6 changes: 4 additions & 2 deletions tests/OmniSharp.Roslyn.CSharp.Tests/TestSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ public class TestGeneratorReference : AnalyzerReference
{
private readonly bool _isEnabledByDefault;
private readonly Action<GeneratorExecutionContext> _execute;
private readonly ImmutableArray<ISourceGenerator> _generators;

public TestGeneratorReference(Action<GeneratorExecutionContext> execute, [CallerMemberName] string testId = "", bool isEnabledByDefault = true)
{
Id = testId;
_isEnabledByDefault = isEnabledByDefault;
_execute = execute;
_generators = ImmutableArray.Create<ISourceGenerator>(new TestSourceGenerator(_execute));
}

public override ImmutableArray<ISourceGenerator> GetGenerators(string language)
=> ImmutableArray.Create<ISourceGenerator>(new TestSourceGenerator(_execute));
=> _generators;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This originally caused a test failure due to changes from dotnet/roslyn#64729. The fix is to not create a new generator each time these methods are called, and instead re-use the existing generator in order to maintain the same documentId.


public override ImmutableArray<ISourceGenerator> GetGeneratorsForAllLanguages()
=> ImmutableArray.Create<ISourceGenerator>(new TestSourceGenerator(_execute));
=> _generators;

public override string FullPath => null;
public override object Id { get; }
Expand Down
12 changes: 6 additions & 6 deletions tests/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Features" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
Expand All @@ -49,7 +49,7 @@

<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<!-- System.Memory assembly version does not align with the NuGet package version.
<!-- System.Memory assembly version does not align with the NuGet package version.
Package version 4.5.5 ships with assembly version 4.0.1.2 -->
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
Expand Down
6 changes: 3 additions & 3 deletions tools/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<package id="xunit.runner.console" version="2.4.0" />

<!-- These packages are dependencies of the .NET Framework builds of OmniSharp -->
<package id="SQLitePCLRaw.bundle_green" version="2.0.7" />
<package id="SQLitePCLRaw.core" version="2.0.7" />
<package id="SQLitePCLRaw.provider.e_sqlite3" version="2.0.7" />
<package id="SQLitePCLRaw.bundle_green" version="2.1.0" />
<package id="SQLitePCLRaw.core" version="2.1.0" />
<package id="SQLitePCLRaw.provider.e_sqlite3" version="2.1.0" />
</packages>