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

Upgrade BCL assembly to 8.0.0 #71444

Merged
merged 17 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
52 changes: 46 additions & 6 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
<SourceBuild RepoName="command-line-api" ManagedOnly="true" />
</Dependency>
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
<Dependency Name="System.IO.Pipelines" Version="7.0.0">
<Dependency Name="System.IO.Pipelines" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>d099f075e45d2aa6007a22b71b45a08758559f80</Sha>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Logging" Version="7.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
Expand All @@ -37,9 +37,9 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>d099f075e45d2aa6007a22b71b45a08758559f80</Sha>
</Dependency>
<Dependency Name="System.Text.Json" Version="7.0.3">
<Dependency Name="System.Text.Json" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>0a2bda10e81d901396c3cff95533529e3a93ad47</Sha>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
Expand Down Expand Up @@ -75,9 +75,29 @@
</Dependency>
<!-- Entries below are necessary for source-build. This allows the packages to be retrieved from previously-source-built
artifacts and flow in as dependencies of the packages produced by roslyn. -->
<Dependency Name="System.Composition" Version="7.0.0">
<Dependency Name="System.Composition" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>d099f075e45d2aa6007a22b71b45a08758559f80</Sha>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Composition.AttributedModel" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Composition.Convention" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Composition.Hosting" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Composition.Runtime" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Composition.TypedParts" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
Expand All @@ -87,5 +107,25 @@
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
<Sha>596f8f422003d89b65e2bd50dc5a1aea7ce4ce91</Sha>
</Dependency>
<Dependency Name="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Collections.Immutable" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Reflection.Metadata" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Text.Encodings.Web" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
<Dependency Name="System.Threading.Channels" Version="8.0.0">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>5535e31a712343a63f5d7d796cd874e563e5ac14</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
18 changes: 9 additions & 9 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,17 @@
<RoslynMicrosoftVisualStudioExtensionManagerVersion>0.0.4</RoslynMicrosoftVisualStudioExtensionManagerVersion>
<SourceBrowserVersion>1.0.21</SourceBrowserVersion>
<SystemBuffersVersion>4.5.1</SystemBuffersVersion>
<SystemCompositionVersion>7.0.0</SystemCompositionVersion>
<SystemCompositionVersion>8.0.0</SystemCompositionVersion>
<SystemCodeDomVersion>7.0.0</SystemCodeDomVersion>
<SystemCommandLineVersion>2.0.0-beta4.23407.1</SystemCommandLineVersion>
<SystemComponentModelCompositionVersion>7.0.0</SystemComponentModelCompositionVersion>
<SystemConfigurationConfigurationManagerVersion>7.0.0</SystemConfigurationConfigurationManagerVersion>
<SystemDrawingCommonVersion>7.0.0</SystemDrawingCommonVersion>
<SystemDrawingCommonVersion>8.0.0</SystemDrawingCommonVersion>
<SystemIOFileSystemVersion>4.3.0</SystemIOFileSystemVersion>
<SystemIOFileSystemPrimitivesVersion>4.3.0</SystemIOFileSystemPrimitivesVersion>
<SystemIOHashingVersion>8.0.0</SystemIOHashingVersion>
<SystemIOPipesAccessControlVersion>5.0.0</SystemIOPipesAccessControlVersion>
<SystemIOPipelinesVersion>7.0.0</SystemIOPipelinesVersion>
<SystemIOPipelinesVersion>8.0.0</SystemIOPipelinesVersion>
<SystemManagementVersion>7.0.0</SystemManagementVersion>
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
<!--
Expand All @@ -251,9 +251,9 @@
<SystemTextEncodingCodePagesVersion>7.0.0</SystemTextEncodingCodePagesVersion>
<SystemTextEncodingExtensionsVersion>4.3.0</SystemTextEncodingExtensionsVersion>
<!-- Note: When updating SystemTextJsonVersion ensure that the version is no higher than what is used by MSBuild. -->
<SystemTextJsonVersion>7.0.3</SystemTextJsonVersion>
<SystemThreadingChannelsVersion>7.0.0</SystemThreadingChannelsVersion>
<SystemThreadingTasksDataflowVersion>7.0.0</SystemThreadingTasksDataflowVersion>
<SystemTextJsonVersion>8.0.0</SystemTextJsonVersion>
<SystemThreadingChannelsVersion>8.0.0</SystemThreadingChannelsVersion>
<SystemThreadingTasksDataflowVersion>8.0.0</SystemThreadingTasksDataflowVersion>
<!-- We need System.ValueTuple assembly version at least 4.0.3.0 on net47 to make F5 work against Dev15 - see https://github.com/dotnet/roslyn/issues/29705 -->
<SystemValueTupleVersion>4.5.0</SystemValueTupleVersion>
<SystemThreadingTasksExtensionsVersion>4.5.4</SystemThreadingTasksExtensionsVersion>
Expand Down Expand Up @@ -294,9 +294,9 @@
When updating the S.C.I or S.R.M version please let the MSBuild team know in advance so they
can update to the same version. Version changes require a VS test insertion for validation.
-->
<SystemCollectionsImmutableVersion>7.0.0</SystemCollectionsImmutableVersion>
<SystemReflectionMetadataVersion>7.0.0</SystemReflectionMetadataVersion>
<MicrosoftBclAsyncInterfacesVersion>7.0.0</MicrosoftBclAsyncInterfacesVersion>
<SystemCollectionsImmutableVersion>8.0.0</SystemCollectionsImmutableVersion>
<SystemReflectionMetadataVersion>8.0.0</SystemReflectionMetadataVersion>
<MicrosoftBclAsyncInterfacesVersion>8.0.0</MicrosoftBclAsyncInterfacesVersion>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<UsingToolVSSDK>true</UsingToolVSSDK>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Roslyn.Test.Utilities.Desktop;
using Xunit;
using Basic.Reference.Assemblies;
using System.Numerics;

namespace Microsoft.CodeAnalysis.UnitTests
{
Expand Down Expand Up @@ -43,6 +44,7 @@ public void TestAnalyzerLoading_AppDomain()
var dir = Temp.CreateDirectory();
dir.CopyFile(typeof(AppDomainUtils).Assembly.Location);
dir.CopyFile(typeof(RemoteAnalyzerFileReferenceTest).Assembly.Location);
dir.CopyFile(typeof(Vector).Assembly.Location);
Copy link
Member Author

Choose a reason for hiding this comment

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

This test would fail on line 54. Exception shows it can't find System.Numerics assembly.

var analyzerFile = DesktopTestHelpers.CreateCSharpAnalyzerAssemblyWithTestAnalyzer(dir, "MyAnalyzer");
var loadDomain = AppDomainUtils.Create("AnalyzerTestDomain", basePath: dir.Path);
try
Expand Down Expand Up @@ -85,6 +87,7 @@ public class TestAnalyzer : DiagnosticAnalyzer
var immutable = dir.CopyFile(typeof(ImmutableArray).Assembly.Location);
var analyzer = dir.CopyFile(typeof(DiagnosticAnalyzer).Assembly.Location);
dir.CopyFile(typeof(RemoteAnalyzerFileReferenceTest).Assembly.Location);
dir.CopyFile(typeof(Vector).Assembly.Location);
Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above comment


var analyzerCompilation = CSharp.CSharpCompilation.Create(
"MyAnalyzer",
Expand Down
3 changes: 2 additions & 1 deletion src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
Public Overrides ReadOnly Property ShouldSkip As Boolean
Get
Try
If RuntimeInformation.IsOSPlatform(OSPlatform.Windows) Then
If RuntimeInformation.IsOSPlatform(OSPlatform.Windows) AndAlso Environment.OSVersion.Version >= New Version(6, 1) Then
' SystemFont.DefaultFont is only available on windows 6.1 and later
Dim result = SystemFonts.DefaultFont

Check failure on line 17 in src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb

View check run for this annotation

Azure Pipelines / roslyn-CI (Correctness Correctness_Analyzers)

src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb#L17

src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb(17,34): error CA1416: (NETCORE_ENGINEERING_TELEMETRY=Build) This call site is reachable on: 'Windows' all versions. 'Public Shared Overloads ReadOnly Property DefaultFont As Font' is only supported on: 'windows' 6.1 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)

Check failure on line 17 in src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb

View check run for this annotation

Azure Pipelines / roslyn-CI

src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb#L17

src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb(17,34): error CA1416: (NETCORE_ENGINEERING_TELEMETRY=Build) This call site is reachable on: 'Windows' all versions. 'Public Shared Overloads ReadOnly Property DefaultFont As Font' is only supported on: 'windows' 6.1 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
Return result Is Nothing
Else
' The only tests using fonts are Windows-only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<PackageReference Include="Microsoft.VisualStudio.Validation" Version="$(MicrosoftVisualStudioValidationVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Debugger.Contracts" Version="$(MicrosoftVisualStudioDebuggerContractsVersion)" />
<PackageReference Include="StreamJsonRpc" Version="$(StreamJsonRpcVersion)" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesVersion)" />
Cosifne marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.EditorFeatures" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsDependencyInjectionVersion)" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesVersion)" />
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't reference this package on .NETCoreApp.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to add this but I get this

.dotnet/sdk/8.0.100/Microsoft.Common.CurrentVersion.targets(2382,5): error MSB3277: (NETCORE_ENGINEERING_TELEMETRY=Build) Found conflicts between different versions of "Microsoft.Bcl.AsyncInterfaces" that could not be resolved.
There was a conflict between "Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" and "Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51".
    "Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was chosen because it was primary and "Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" was not.
    References which depend on "Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [/mnt/vss/_work/1/s/.packages/microsoft.bcl.asyncinterfaces/7.0.0/lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll].
        /mnt/vss/_work/1/s/.packages/microsoft.bcl.asyncinterfaces/7.0.0/lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll
          Project file item includes which caused reference "/mnt/vss/_work/1/s/.packages/microsoft.bcl.asyncinterfaces/7.0.0/lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll".
            /mnt/vss/_work/1/s/.packages/microsoft.bcl.asyncinterfaces/7.0.0/lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll
    References which depend on "Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" [].
        /mnt/vss/_work/1/s/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.Protocol/Debug/netstandard2.0/Microsoft.CodeAnalysis.LanguageServer.Protocol.dll
          Project file item includes which caused reference "/mnt/vss/_work/1/s/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.Protocol/Debug/netstandard2.0/Microsoft.CodeAnalysis.LanguageServer.Protocol.dll".
            /mnt/vss/_work/1/s/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.Protocol/Debug/netstandard2.0/Microsoft.CodeAnalysis.LanguageServer.Protocol.dll
        /mnt/vss/_work/1/s/artifacts/bin/Microsoft.CommonLanguageServerProtocol.Framework/Debug/netstandard2.0/Microsoft.CommonLanguageServerProtocol.Framework.dll
          Project file item includes which caused reference "/mnt/vss/_work/1/s/artifacts/bin/Microsoft.CommonLanguageServerProtocol.Framework/Debug/netstandard2.0/Microsoft.CommonLanguageServerProtocol.Framework.dll".
            /mnt/vss/_work/1/s/artifacts/bin/Microsoft.CommonLanguageServerProtocol.Framework/Debug/netstandard2.0/Microsoft.CommonLanguageServerProtocol.Framework.dll
            /mnt/vss/_work/1/s/artifacts/bin/Microsoft.CodeAnalysis.LanguageServer.Protocol/Debug/netstandard2.0/Microsoft.CodeAnalysis.LanguageServer.Protocol.dll

From project.assets.json file I see it the project is referencing the 7.0.0 BCL in net6.0 TFM. My guess is it might be introduced by other packages used in project. And Roslyn is referencing 8.0.0 BCL in other referenced projects so it causes the conflict.
This is by far the easiest way I found to solve the issue.

Copy link
Member

Choose a reason for hiding this comment

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

I believe the request here is to add it to a conditional item group:

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
  <PackageReference ... />
</ItemGroup>

Copy link
Member

@ViktorHofer ViktorHofer Jan 3, 2024

Choose a reason for hiding this comment

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

Looks like the following packages bring M.Bcl.AsyncInterfaces in on .NETCoreApp:

  • Microsoft.VisualStudio.Threading/17.7.35
  • Nerdbank.Streams/2.10.69
  • StreamJsonRpc/2.17.8

Those packages should be updated to not reference M.Bcl.AsyncInterfaces. I submitted microsoft/vs-threading#1269, dotnet/Nerdbank.Streams#723 and microsoft/vs-streamjsonrpc#987 to fix that.

Meanwhile I understand that you want to upgrade the transitive package dependency. Did you consider using NuGet Central Package Management with the transitive pinning feature? That would allow you to do that automatically without needing to add an extra PackageReference in this project.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am thinking about this. The main purpose of this PR is Roslyn also ships a few dlls, which needs to match the dlls version in msbuild. (e.g SystemCollectionsImmutableVersion and SystemReflectionMetadataVersion)
Even other packages in VS move to the new version (like BCL) it might be fine since we don't ship that dlls. We can wait for the upstream packages to update and later update all other stuff here.
So here we just want to find a sweet point without too many other tricks. Testing now..

</ItemGroup>

<ItemGroup Label="Project References">
Expand Down
Loading