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

Build FAILED after #106209 PR (Implement type name resolution for ILLink analyzer) #106321

Closed
AlexRadch opened this issue Aug 13, 2024 · 17 comments
Closed

Comments

@AlexRadch
Copy link
Contributor

AlexRadch commented Aug 13, 2024

Description

After I installed the new .NET SDK 9.0.100-preview.7.24407.12 globally, the runtime build was successful.

Can not build runtime after #106209 PR (Implement type name resolution for ILLink analyzer)

With the next log:

  System.Private.CoreLib -> C:\AProj\runtime\artifacts\bin\System.Private.CoreLib\ref\Release\net9.0\System.Private.CoreLib.dll

Build FAILED.

CSC : error CS8032: An instance of analyzer ILLink.RoslynAnalyzer.RequiresUnreferencedCodeAnalyzer cannot be created from C:\AProj\runtime\artifacts\bin\ILLink.RoslynAnalyzer\Debug\netstandard2.0\ILLink.RoslynAnalyzer.dll : Could not load file or assembly 'System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The specified file cannot be found. [C:\AProj\runtime\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
CSC : error CS8032: An instance of analyzer ILLink.RoslynAnalyzer.RequiresAssemblyFilesAnalyzer cannot be created from C:\AProj\runtime\artifacts\bin\ILLink.RoslynAnalyzer\Debug\netstandard2.0\ILLink.RoslynAnalyzer.dll : Could not load file or assembly 'System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The specified file cannot be found. [C:\AProj\runtime\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
CSC : error CS8032: An instance of analyzer ILLink.RoslynAnalyzer.COMAnalyzer cannot be created from C:\AProj\runtime\artifacts\bin\ILLink.RoslynAnalyzer\Debug\netstandard2.0\ILLink.RoslynAnalyzer.dll : Could not load file or assembly 'System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The specified file cannot be found. [C:\AProj\runtime\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
CSC : error CS8032: An instance of analyzer ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer cannot be created from C:\AProj\runtime\artifacts\bin\ILLink.RoslynAnalyzer\Debug\netstandard2.0\ILLink.RoslynAnalyzer.dll : Could not load file or assembly 'System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The specified file cannot be found. [C:\AProj\runtime\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
CSC : error CS8032: An instance of analyzer ILLink.RoslynAnalyzer.RequiresDynamicCodeAnalyzer cannot be created from C:\AProj\runtime\artifacts\bin\ILLink.RoslynAnalyzer\Debug\netstandard2.0\ILLink.RoslynAnalyzer.dll : Could not load file or assembly 'System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The specified file cannot be found. [C:\AProj\runtime\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
    0 Warning(s)
    5 Error(s)

Time Elapsed 00:01:14.99
Build failed with exit code 1. Check errors above.
Some builds failed:
        Configuration: Debug, Architecture: x64

Reproduction Steps

git clean -xdf
git pull upstream main
build.cmd clr+libs -rc Release

Expected behavior

Successful Build.

Actual behavior

Build FAILED

Regression?

Yes

Known Workarounds

  1. After I removed the .Net 9 global SDK, the build was successful.
  2. Or use runtime before this PR.

Configuration

.NET 9.0.100-preview.6.24328.19 installed globally
Windows 10
x64

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 13, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Aug 13, 2024
@huoyaoyuan
Copy link
Member

I can also reproduce this in VS.

@huoyaoyuan huoyaoyuan added area-Infrastructure-libraries and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Aug 13, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

@ViktorHofer
Copy link
Member

I can reproduce this as well. Uninstalling the global SDK helped in my case.

@pavelsavara
Copy link
Member

same here, deleting my local dotnet installation helped.

@sbomer
Copy link
Member

sbomer commented Aug 13, 2024

I haven't been able to reproduce this build failure locally. @ViktorHofer you suggested in #106209 (comment) that the reference to System.Reflection.Metadata might be too new - can you elaborate? I would have expected the analyzer reference to load these from nuget when building locally.

@sbomer
Copy link
Member

sbomer commented Aug 13, 2024

@huoyaoyuan would you be able to share repro instructions that hit this in VS?

@AlexRadch
Copy link
Contributor Author

After I removed the .Net 9 global SDK, the build was successful.

@sbomer
Copy link
Member

sbomer commented Aug 13, 2024

Odd, that suggests to me that the build was picking up an older version of the global SDK, but shouldn't that be prevented by the version in global.json? More specific repro steps would be helpful.

@elinor-fung
Copy link
Member

elinor-fung commented Aug 13, 2024

I'd guess you want SystemReflectionMetadataToolsetVersion instead of SystemReflectionMetadataVersion. I know for HostModel and other things that get loaded in build, we keep the version <= than that in MSBuild/SDK because MSBuild uses those same dependencies and has binding redirects that can end up in some sort of mismatch.

@sbomer
Copy link
Member

sbomer commented Aug 13, 2024

Unfortunately, that version doesn't have TypeNameParseOptions (from .NET 9) that the change needs. I think you're right that it's due to some version mismatch with the MSBuild/SDK dependencies, or maybe it's not finding the dependency at all when running on full framework MSBuild.

@AlexRadch
Copy link
Contributor Author

AlexRadch commented Aug 13, 2024

Odd, that suggests to me that the build was picking up an older version of the global SDK, but shouldn't that be prevented by the version in global.json? More specific repro steps would be helpful.

When I install the latest .Net 9.0.100-preview.6.24328.19 globally, then the build FAILS.

@sbomer
Copy link
Member

sbomer commented Aug 13, 2024

@elinor-fung pointed me to #97021 (comment) which looks like it describes the problem here. I see binding redirects that redirect to the 8.0 version of System.Collections.Immutable, and per the linked comment it sounds like any references to a 9.0.0 version will cause problems until the binding redirects are updated.

@noahfalk
Copy link
Member

More specific repro steps would be helpful.

If it helps my repro of this:

  1. These SDKs were already installed:

C:\git\runtime3>dotnet --list-sdks
C:\Program Files\dotnet
8.0.108 [C:\Program Files\dotnet\sdk]
8.0.303 [C:\Program Files\dotnet\sdk]
8.0.400-preview.0.24324.5 [C:\Program Files\dotnet\sdk]
9.0.100-preview.6.24328.19 [C:\Program Files\dotnet\sdk]

  1. Clone the runtime repo and pull from https://github.com/dotnet/runtime main

C:\git\runtime3>git log
commit ec7fd04 (HEAD -> main, upstream/main, origin/main, master)
Author: Viktor Hofer [email protected]
Date: Tue Aug 13 19:29:08 2024 +0200

  1. Build libs

build.cmd libs

@sbomer
Copy link
Member

sbomer commented Aug 13, 2024

Thanks, I was able to repro it with a global SDK install. I'll revert the change and probably wait for .NET 10 to make the fix.

@huoyaoyuan
Copy link
Member

@huoyaoyuan would you be able to share repro instructions that hit this in VS?

Just pulled the change in VS, and invoke "Rebuild" for CoreLib. It's now failing.

@sbomer
Copy link
Member

sbomer commented Aug 13, 2024

The change has been reverted: #106343

@sbomer sbomer closed this as completed Aug 13, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Aug 13, 2024
@AlexRadch
Copy link
Contributor Author

After I installed the new .NET SDK 9.0.100-preview.7.24407.12 globally, the runtime build was successful.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants