Skip to content

Update Microsoft.CodeAnalysis.Collections et al.#12161

Merged
YuliiaKovalova merged 6 commits intodotnet:mainfrom
teo-tsirpanis:ms-ca-source-pkgs-bump
Jul 14, 2025
Merged

Update Microsoft.CodeAnalysis.Collections et al.#12161
YuliiaKovalova merged 6 commits intodotnet:mainfrom
teo-tsirpanis:ms-ca-source-pkgs-bump

Conversation

@teo-tsirpanis
Copy link
Copy Markdown
Contributor

Context

The Microsoft.Build project has a dependency on the Microsoft.CodeAnalysis.Collections source-only package, but that package is depended on by the Microsoft.Build.Framework project, and gets transitively consumed by Build.

In #11109, as an effort to reduce the size of the Framework assembly, I tried to move the dependency to a direct one on Build. This led to failures that would be fixed in a newer version of Microsoft.CodeAnalysis.Collections. Because the update is more involved than a simple version bump, I extracted that change from #11109 into its own PR.

Changes Made

  • Microsoft.CodeAnalysis.Collections dependency updated to 5.0.0-1.25277.114, released a month ago.
    • Added dependency to Microsoft.CodeAnalysis.Contracts and PooledObjects, that are required by the above.
  • Moved dependency to Microsoft.CodeAnalysis.Collections from the Microsoft.Build.Framework project to Microsoft.Build.
    • This led to surfacing a direct dependency of Microsoft.Build.Framework to the System.Collections.Immutable package.
  • Fixed failures caused by duplicate polyfills.
    • Some polyfills were removed and are now acquired through Microsoft.CodeAnalysis.Contracts.

Testing

Build-only change, validated by successfully building Microsoft.Build locally.

Notes

Copilot AI review requested due to automatic review settings July 12, 2025 17:34
@teo-tsirpanis teo-tsirpanis requested a review from a team as a code owner July 12, 2025 17:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the Roslyn collections package and adjusts how its polyfills are consumed across the Microsoft.Build and Microsoft.Build.Framework projects.

  • Bump Microsoft.CodeAnalysis.Collections to 5.0.0-1.25277.114 and bring in its new dependencies (Contracts and PooledObjects)
  • Move the CodeAnalysis.Collections package reference from MSBuild.Framework to MSBuild and remove duplicate polyfills
  • Remove legacy nullable-attributes polyfills now provided by the updated contracts package

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Shared/IsExternalInit.cs Added assembly type-forward for IsExternalInit on .NET and kept the old polyfill for earlier TFMs
src/Framework/Polyfills/NullableAttributes.cs Deleted all nullable attribute polyfills, relying on Microsoft.CodeAnalysis.Contracts instead
src/Framework/Microsoft.Build.Framework.csproj Replaced the Collections reference with Contracts and added System.Collections.Immutable
src/Framework/AssemblyUtilities.cs Removed duplicate IsExternalInit polyfill
src/Build/Microsoft.Build.csproj Added CodeAnalysis.Collections and PooledObjects refs; commented out manual IsExternalInit compile
eng/Versions.props Bumped MicrosoftCodeAnalysisCollectionsVersion to 5.0.0-1.25277.114
eng/Packages.props Added package versions for Contracts and PooledObjects
Comments suppressed due to low confidence (1)

eng/Packages.props:13

  • [nitpick] The Contracts and PooledObjects packages share the Collections version variable; consider introducing dedicated version properties to reduce confusion if package versions diverge in the future.
    <PackageVersion Include="Microsoft.CodeAnalysis.Contracts" Version="$(MicrosoftCodeAnalysisCollectionsVersion)" />

@teo-tsirpanis teo-tsirpanis changed the title Update Microsoft.CodeAnalysis.Collections et. al. Update Microsoft.CodeAnalysis.Collections et al. Jul 14, 2025
@YuliiaKovalova YuliiaKovalova merged commit 2e0a8ee into dotnet:main Jul 14, 2025
9 checks passed
@teo-tsirpanis teo-tsirpanis deleted the ms-ca-source-pkgs-bump branch July 14, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants