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

Bump up the Microsoft.CodeAnalysis version used by packages in the repo #6701

Merged
merged 14 commits into from
Jul 1, 2023

Conversation

mavasani
Copy link
Contributor

@mavasani mavasani commented Jun 21, 2023

Bump up the Microsoft.CodeAnalysis version used by packages in the repo to 3.11.0 (VS2019 16.11), except PublicApiAnalyzers, and also bump up the version of the generated analyzer packages in the repo.

This brings in the nullable annotated API surfaces for ISymbol, IOperation and syntax APIs, which generates a large number of new nullable warnings. This PR also fixes/suppresses these warnings as appropriate.

Closes #6089

…po (except PublicApiAnalyzers) to 3.11.0 (VS2019 16.11) and also bump up the version of the generated analyzer packages in the repo.

This brings in the nullable annotated API surfaces for ISymbol, IOperation and syntax APIs, which generates a large number of new nullable warnings. This PR also fixes/suppresses these warnings, as appropriate.
@mavasani
Copy link
Contributor Author

@Youssef1313

eng/Versions.props Outdated Show resolved Hide resolved
Copy link
Member

@Youssef1313 Youssef1313 left a comment

Choose a reason for hiding this comment

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

Haven't looked into every line (it's a quite large PR), but going through quickly, LGTM!

@mavasani mavasani marked this pull request as ready for review June 22, 2023 06:16
@mavasani mavasani requested a review from a team as a code owner June 22, 2023 06:16
Comment on lines 61 to 73
<!-- Microsoft.CodeAnalysis versions for different purposes. -->
<!-- Surface area that various projects compile against. These should have source-build reference packages -->
<MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>3.7.0</MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>
<MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>3.11.0</MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion>
<MicrosoftCodeAnalysisVersionForPublicApiAnalyzers>1.2.1</MicrosoftCodeAnalysisVersionForPublicApiAnalyzers>
<MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>2.9.0</MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>
<MicrosoftCodeAnalysisVersionForBannedApiAnalyzersTests>3.3.1</MicrosoftCodeAnalysisVersionForBannedApiAnalyzersTests>
<MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>2.9.0</MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>
<MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzersTests>3.3.1</MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzersTests>
<MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForBannedApiAnalyzers>
<MicrosoftCodeAnalysisVersionForBannedApiAnalyzersTests>3.11.0</MicrosoftCodeAnalysisVersionForBannedApiAnalyzersTests>
<MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzers>
<MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzersTests>3.11.0</MicrosoftCodeAnalysisVersionForPerfSensitiveAnalyzersTests>
<MicrosoftCodeAnalysisVersionForResxSourceGenerators>4.0.1</MicrosoftCodeAnalysisVersionForResxSourceGenerators>
<MicrosoftCodeAnalysisVersionForNetAnalyzers>3.3.1</MicrosoftCodeAnalysisVersionForNetAnalyzers>
<MicrosoftCodeAnalysisVersionForTextAnalyzers>3.3.1</MicrosoftCodeAnalysisVersionForTextAnalyzers>
<MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>3.3.1</MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>
<MicrosoftCodeAnalysisVersionForToolsAndUtilities>3.3.1</MicrosoftCodeAnalysisVersionForToolsAndUtilities>
<MicrosoftCodeAnalysisVersionForNetAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForNetAnalyzers>
<MicrosoftCodeAnalysisVersionForTextAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForTextAnalyzers>
<MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>3.11.0</MicrosoftCodeAnalysisVersionForCodeAnalysisAnalyzers>
<MicrosoftCodeAnalysisVersionForToolsAndUtilities>3.11.0</MicrosoftCodeAnalysisVersionForToolsAndUtilities>
Copy link
Contributor Author

@mavasani mavasani Jun 22, 2023

Choose a reason for hiding this comment

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

@mmitche @MichaelSimons This PR moves the referenced Microsoft.CodeAnalysis versions for the packages to 3.11.0 (shipped with VS2019 16.11) and fixes a bunch of nullable compiler warnings that were coming from the new packages.

However, this fails the pre-build detection step for source build that you added with #6610. I see that dotnet/source-build-reference-packages#692 added the SB reference packages for the prior versions of the dependency packages, and are being mapped from here:

<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="8.0.0-alpha.1.23305.4">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>540ccf1a6831993d8ac8bf10bdfd3fde93ecee2e</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>

I presume this PR would require an update to the SB packages to add the 3.11.0 version of the packages before we can pass the pre-build detection leg. Is that correct? If so, who can help me out to perform this update in https://github.com/dotnet/source-build-reference-packages? If there are documentation pointers on how to go about this, please share them so I can try to do this myself. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried executing those steps locally, but I get a build failure at the first step itself:

generate.cmd -package microsoft.codeanalysis,3.11.0

Error:

  PackageSourceGenerator -> Generating package source for Humanizer.Core (v2.2.0)...
  Determining projects to restore...
  Restored C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGenerator.proj (in 5 ms).
  Restored C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGeneratorTask\PackageSourceGenera
  torTask.csproj (in 136 ms).
C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGenerator.proj(106,5): error MSB4018: The "G
etPackageItems" task failed unexpectedly.
C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGenerator.proj(106,5): error MSB4018: System
.ArgumentException: Found strong name key that doesn't map: Key=979442b78dfc278e, Assembly=Humanizer
C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGenerator.proj(106,5): error MSB4018:    at
Microsoft.DotNet.SourceBuild.Tasks.GetPackageItems.TryGetStrongNameData(AssemblyName assemblyName, StrongNameData& stro
ngNameData) in C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGeneratorTask\GetPackageItems
.cs:line 241
C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGenerator.proj(106,5): error MSB4018:    at
Microsoft.DotNet.SourceBuild.Tasks.GetPackageItems.SetCompileItems(PackageArchiveReader packageArchiveReader, TargetFra
meworkRegexFilter targetFrameworkRegexFilter) in C:\source-build-reference-packages\src\packageSourceGenerator\PackageS
ourceGeneratorTask\GetPackageItems.cs:line 153
C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGenerator.proj(106,5): error MSB4018:    at
Microsoft.DotNet.SourceBuild.Tasks.GetPackageItems.Execute() in C:\source-build-reference-packages\src\packageSourceGen
erator\PackageSourceGeneratorTask\GetPackageItems.cs:line 84
C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGenerator.proj(106,5): error MSB4018:    at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
C:\source-build-reference-packages\src\packageSourceGenerator\PackageSourceGenerator.proj(106,5): error MSB4018:    at
Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext ta
skLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

Warnings:

C:\Users\mavasani\.nuget\packages\microsoft.dotnet.genapi.task\8.0.100-preview.6.23319.8\build\Microsoft.DotNet.GenAPI.
Task.targets(45,5): warning CP1002: Could not resolve reference 'SQLitePCLRaw.core.dll' in any of the provided search d
irectories. [C:\source-build-reference-packages\artifacts\bin\PackageSourceGenerator\microsoft.codeanalysis.csharp.work
spaces\3.11.0\microsoft.codeanalysis.csharp.workspaces.3.11.0.csproj::TargetFramework=netstandard2.0]
C:\Users\mavasani\.nuget\packages\microsoft.dotnet.genapi.task\8.0.100-preview.6.23319.8\build\Microsoft.DotNet.GenAPI.
Task.targets(45,5): warning CP1002: Could not resolve reference 'SQLitePCLRaw.batteries_v2.dll' in any of the provided
search directories. [C:\source-build-reference-packages\artifacts\bin\PackageSourceGenerator\microsoft.codeanalysis.csh
arp.workspaces\3.11.0\microsoft.codeanalysis.csharp.workspaces.3.11.0.csproj::TargetFramework=netstandard2.0]
C:\Users\mavasani\.nuget\packages\microsoft.dotnet.genapi.task\8.0.100-preview.6.23319.8\build\Microsoft.DotNet.GenAPI.
Task.targets(45,5): warning CP1002: Could not resolve reference 'Humanizer.dll' in any of the provided search directori
es. [C:\source-build-reference-packages\artifacts\bin\PackageSourceGenerator\microsoft.codeanalysis.csharp.workspaces\3
.11.0\microsoft.codeanalysis.csharp.workspaces.3.11.0.csproj::TargetFramework=netstandard2.0]
C:\Users\mavasani\.nuget\packages\microsoft.dotnet.genapi.task\8.0.100-preview.6.23319.8\build\Microsoft.DotNet.GenAPI.
Task.targets(45,5): warning CP1002: Could not resolve reference 'Humanizer.dll' in any of the provided search directori
es. [C:\source-build-reference-packages\artifacts\bin\PackageSourceGenerator\microsoft.codeanalysis.csharp.workspaces\3
.11.0\microsoft.codeanalysis.csharp.workspaces.3.11.0.csproj::TargetFramework=netstandard2.0]
C:\Users\mavasani\.nuget\packages\microsoft.dotnet.genapi.task\8.0.100-preview.6.23319.8\build\Microsoft.DotNet.GenAPI.
Task.targets(45,5): warning CP1002: Could not resolve reference 'SQLitePCLRaw.core.dll' in any of the provided search d
irectories. [C:\source-build-reference-packages\artifacts\bin\PackageSourceGenerator\microsoft.codeanalysis.workspaces.
common\3.11.0\microsoft.codeanalysis.workspaces.common.3.11.0.csproj::TargetFramework=netstandard2.0]
C:\Users\mavasani\.nuget\packages\microsoft.dotnet.genapi.task\8.0.100-preview.6.23319.8\build\Microsoft.DotNet.GenAPI.
Task.targets(45,5): warning CP1002: Could not resolve reference 'SQLitePCLRaw.batteries_v2.dll' in any of the provided
search directories. [C:\source-build-reference-packages\artifacts\bin\PackageSourceGenerator\microsoft.codeanalysis.wor
kspaces.common\3.11.0\microsoft.codeanalysis.workspaces.common.3.11.0.csproj::TargetFramework=netstandard2.0]
C:\Users\mavasani\.nuget\packages\microsoft.dotnet.genapi.task\8.0.100-preview.6.23319.8\build\Microsoft.DotNet.GenAPI.
Task.targets(45,5): warning CP1002: Could not resolve reference 'Humanizer.dll' in any of the provided search directori
es. [C:\source-build-reference-packages\artifacts\bin\PackageSourceGenerator\microsoft.codeanalysis.workspaces.common\3
.11.0\microsoft.codeanalysis.workspaces.common.3.11.0.csproj::TargetFramework=netstandard2.0]

Copy link
Member

Choose a reason for hiding this comment

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

….0.1, it doesn't work against 3.11.0 version of Microsoft.CodeAnalysis.Features package. Also make sure that we don't package unnecessary third-party assemblies within the Metrics package, these fail the signing step.
@codecov
Copy link

codecov bot commented Jun 22, 2023

Codecov Report

Merging #6701 (1b07c44) into main (21a3b16) will decrease coverage by 0.04%.
The diff coverage is 78.72%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6701      +/-   ##
==========================================
- Coverage   96.36%   96.33%   -0.04%     
==========================================
  Files        1395     1393       -2     
  Lines      325074   325082       +8     
  Branches    10676    10711      +35     
==========================================
- Hits       313265   313165     -100     
+ Misses       9242     9212      -30     
- Partials     2567     2705     +138     

Comment on lines 56 to +57
arguments.Length == 5 &&
arguments[0].Parameter.Type.SpecialType == SpecialType.System_String,
arguments[0].Parameter?.Type.SpecialType == SpecialType.System_String,
Copy link
Member

Choose a reason for hiding this comment

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

The length and value check can be combined:

arguments is [{ Parameter.Type.SpecialType: SpecialType.System_String }, _, _, _, _]

mavasani added a commit to mavasani/source-build-reference-packages that referenced this pull request Jun 23, 2023
Required for dotnet/roslyn-analyzers#6701, which moves the analyzer packages in that repo to Microsoft.CodeAnalysis 3.11.0.
@mavasani
Copy link
Contributor Author

The PR is now green, except for the Source build failure due to missing pre-built packages detection. Opened dotnet/source-build-reference-packages#727 to help with that.

MichaelSimons added a commit to dotnet/source-build-reference-packages that referenced this pull request Jun 23, 2023
* Add Microsoft.CodeAnalysis 3.11.0 SB package dependencies

Required for dotnet/roslyn-analyzers#6701, which moves the analyzer packages in that repo to Microsoft.CodeAnalysis 3.11.0.

* Revert previous updates to existing projects

This reverts commit 64a9f53.

* Update build.props

* Regen Microsoft.CodeAnalysis 3.11.0

* Fix syntax errors in generated code.

* Remove Microsoft.CodeAnalysis.Analyzers reference

* Update meta package reference

---------

Co-authored-by: Michael Simons <msimons@microsoft.com>
dotnet-bot pushed a commit to dotnet/dotnet that referenced this pull request Jun 23, 2023
…lysis 3.11.0 SB package dependencies (#727)

* Add Microsoft.CodeAnalysis 3.11.0 SB package dependencies

Required for dotnet/roslyn-analyzers#6701, which moves the analyzer packages in that repo to Microsoft.CodeAnalysis 3.11.0.

* Revert previous updates to existing projects

This reverts commit 64a9f5352401bcbc718799cb91cccc9115acd69e.

* Update build.props

* Regen Microsoft.CodeAnalysis 3.11.0

* Fix syntax errors in generated code.

* Remove Microsoft.CodeAnalysis.Analyzers reference

* Update meta package reference

---------

Co-authored-by: Michael Simons <msimons@microsoft.com>

Original commit: dotnet/source-build-reference-packages@e910f7b

[[ commit created by automation ]]
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>66a912c9463eebe832cf742d2fe8bb2e1a4600ec</Sha>
<Sha>ae1fff344d46976624e68ae17164e0607ab68b10</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="8.0.0-alpha.1.23305.4">
Copy link
Contributor Author

@mavasani mavasani Jun 24, 2023

Choose a reason for hiding this comment

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

@MichaelSimons I presume we would need to update the package version here and also update the SHA below. Can you please point me to the package feed where this package is published OR point out the new package version to use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MichaelSimons @mmitche Can you please help here?

Copy link
Member

Choose a reason for hiding this comment

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

A darc subscription should be defined to automatically update this dependency. You can use the darc cli to find the latest version info and feed.

> darc get-asset --name Microsoft.SourceBuild.Intermediate.source-build-reference-packages
Looking up assets with name 'Microsoft.SourceBuild.Intermediate.source-build-reference-packages' in the last 30 days
Microsoft.SourceBuild.Intermediate.source-build-reference-packages @ 8.0.0-alpha.1.23328.2
Repository:    https://github.com/dotnet/source-build-reference-packages
Branch:        main
Commit:        5740876021887c3a50d3dae34cc125dbab36316f
Build Number:  20230628.2
Date Produced: 2023-06-28 11:31 AM
Build Link:    https://dev.azure.com/dnceng/internal/_build/results?buildId=2211175
BAR Build Id:  183409
Released:      False
Channels:
- .NET Eng - Latest
Locations:
- https://dev.azure.com/dnceng/internal/_apis/build/builds/2211175/artifacts (Container)
- https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json (NugetFeed)

...

@mavasani
Copy link
Contributor Author

@MichaelSimons Seems there are more source build related failures. I'll work on fixing these.

.packages/microsoft.dotnet.arcade.sdk/8.0.0-beta.23269.1/tools/SourceBuild/AfterSourceBuild.proj(68,5): error : (NETCORE_ENGINEERING_TELEMETRY=AfterSourceBuild) 2 new pre-builts discovered! Detailed usage report can be found at /mnt/vss/_work/1/s/artifacts/source-build/self/prebuilt-report/baseline-comparison.xml.
See aka.ms/dotnet/prebuilts for guidance on what pre-builts are and how to eliminate them.
Package IDs are:
System.IO.Pipelines.6.0.3
System.Threading.Channels.6.0.0

mavasani added a commit to mavasani/source-build-reference-packages that referenced this pull request Jun 29, 2023
dotnet/roslyn-analyzers#6701 (comment) requires couple more package dependencies:
   - System.IO.Pipelines.6.0.3
   - System.Threading.Channels.6.0.0
mavasani added a commit to mavasani/source-build-reference-packages that referenced this pull request Jun 29, 2023
dotnet/roslyn-analyzers#6701 (comment) requires couple more package dependencies:
   - System.IO.Pipelines.6.0.3
   - System.Threading.Channels.6.0.0
mavasani added a commit to mavasani/source-build-reference-packages that referenced this pull request Jun 29, 2023
dotnet/roslyn-analyzers#6701 (comment) requires couple more package dependencies:
   - System.IO.Pipelines.6.0.3
   - System.Threading.Channels.6.0.0
eng/Version.Details.xml Outdated Show resolved Hide resolved
eng/Version.Details.xml Outdated Show resolved Hide resolved
@mavasani mavasani merged commit 8baa571 into dotnet:main Jul 1, 2023
11 checks passed
@mavasani mavasani deleted the MoveToNewMSCAReference branch July 1, 2023 18:58
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.

Revise usages of IObjectCreationOperation.Constructor
4 participants