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

Conversation

Cosifne
Copy link
Member

@Cosifne Cosifne commented Jan 2, 2024

Requested because VS updated to 8.0.0.

@Cosifne Cosifne requested a review from a team as a code owner January 2, 2024 18:10
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 2, 2024
@Cosifne
Copy link
Member Author

Cosifne commented Jan 2, 2024

cc @jaredpar

@Cosifne Cosifne requested a review from a team as a code owner January 2, 2024 20:46
@Cosifne
Copy link
Member Author

Cosifne commented Jan 2, 2024

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@Cosifne Cosifne requested a review from a team as a code owner January 3, 2024 02:29
@@ -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..

@@ -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.

@@ -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

@Cosifne
Copy link
Member Author

Cosifne commented Jan 3, 2024

A few things need to be checked before this is good to merge.

  • Do we only need to update S.C.I and S.R.M. (Waiting others reply)
  • Fix the source build.
  • There is a compiler side change after updating S.R.M. (Needs a signed off from compiler folks)

There are many undo/redo commits in the PR, will squash them when merging.

@Cosifne Cosifne changed the base branch from main to release/dev17.9 January 3, 2024 23:16
@Cosifne
Copy link
Member Author

Cosifne commented Jan 3, 2024

Retargeting 17.9, this is needed in P3

@@ -1586,7 +1586,7 @@ .maxstack 2
");
}

[Fact]
[ConditionalFact(typeof(IsEnglishLocal))]
Copy link
Member Author

@Cosifne Cosifne Jan 4, 2024

Choose a reason for hiding this comment

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

Failed in Spanish VM
image
Loosk like it is asserting Error message, and the message is localized now.
So I changed this to English only

Copy link
Member Author

Choose a reason for hiding this comment

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

Talked to Compiler folks offline and verifed this is OK

Copy link
Contributor

Choose a reason for hiding this comment

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

@Cosifne

Talked to Compiler folks offline and verifed this is OK

I think we should open an issue for the test infrastructure. It should make sure that verification errors are obtained in English. Then this change should be reverted

Copy link
Contributor

Choose a reason for hiding this comment

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

Opened #71509.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants