runtime: Unable to build: Unable to load Analyzer assembly

Description

With the latest HEAD of runtime I’m unable to build on Arm64 and X64 Linux.

Lots of errors that look like this: CSC : error CS8034: Unable to load Analyzer assembly /home/alahay01/.nuget/packages/microsoft.codeanalysis.csharp.codestyle/4.4.0-2.22423.18/analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp.CodeStyle, Version=4.4.6.42318, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Access is denied. [/home/alahay01/dotnet/runtime_csel_else/src/tasks/AndroidAppBuilder/AndroidAppBuilder.csproj]

Reproduction Steps

git reset --hard 1f0a0960029
rm -fr artifacts
rm -fr .dotnet
./build.sh -rc checked -lc release

Expected behavior

A clean build 😃

Actual behavior

Full output: log.txt

Regression?

Used to work. Was working at 17d613e4919

Known Workarounds

None 😦

Configuration

Arm64 Linux Ubuntu 18.04

Other information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (29 by maintainers)

Most upvoted comments

This issue will only occur when there are multiple usernames running builds on the same machine without using docker and without clearing out /tmp/ between builds.

Suspect this is the roughly the location of the issue: https://github.com/dotnet/roslyn/blob/158ba3aaff230b1b89284406323fcc79fa2d04e2/src/Compilers/Server/VBCSCompiler/CompilerRequestHandler.cs#L44 public IAnalyzerAssemblyLoader AnalyzerAssemblyLoader { get; } = new ShadowCopyAnalyzerAssemblyLoader(Path.Combine(Path.GetTempPath(), “VBCSCompiler”, “AnalyzerAssemblyLoader”));

Something just needs to ensure that any tmp directories that get created are set to be writable by anyone.

Spoke with @jkoritzinsky and we have a suspicion that it could be because of https://github.com/dotnet/roslyn/pull/64831.

Based on the evidence here that does seem like a good candidate but I’m struggling to see how that could result in an Access Denied error. This didn’t change how we load assemblies, just where we load them …

Let me see if I can repro this.