Broken GitHub analysis - error MSB3677: Unable to move file

Hi,
I am getting same errors, since yesterday on GitHub Actions. I’m using Sonar for a solution based only on .NET 5 and it’s failing on a front end project for Angular SPA. If it also matters, I’m using Docker for the whole thing.

I replaced the sensitive data with ProjectName

/home/runner/work/ProjectName/ProjectName/.sonarqube/bin/targets/SonarQube.Integration.targets(405,5): error MSB3677: Unable to move file "/home/runner/work/ProjectName/ProjectName/.sonarqube/out/47/ProjectInfo.xml" to "/ProjectInfo.xml". Access to the path '/ProjectInfo.xml' is denied. [/home/runner/work/ProjectName/ProjectName/src/Frontend/ProjectName.Frontend.Web.csproj]
    72 Warning(s)
    1 Error(s)

Time Elapsed 00:02:36.24

My project structure looks like this:

image

I’m collecting coverage from integration and unit tests projects.

This is my workflow file:

name: (Backend) SonarQube analysis
on:
  workflow_dispatch:
  push:
    branches:
      - develop
  pull_request:
    types: [opened, synchronize, reopened]
jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
            java-version: 1.11
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Install SonarCloud scanner
        shell: bash
        run: |
          dotnet tool install --global dotnet-sonarscanner
      - name: Setup infrastructure
        shell: bash
        run: |
          pushd .
          cd ./src
          docker-compose up -d mariadb postgres
          sleep 20
          tar -xvf ./Backups/frontendV2.tar.gz
          docker exec -i MariaDB mysql -uroot -proot frontendV2 < ./frontendV2/frontendV2.sql
          popd
      - name: Build and analyze
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE: false  # Disable config files watch https://stackoverflow.com/a/67111195/8065832
        shell: bash
        run: |
          dotnet sonarscanner begin /k:"ProjectName" /o:"ProjectName" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="./src/Tests/ProjectName.UnitTests/coverage.opencover.xml,./src/Tests/ProjectName.IntegrationTests/coverage.opencover.xml" /d:sonar.coverage.exclusions="./src/Tests/*.cs"
          dotnet test ./src/Tests/ProjectName.UnitTests/ProjectName.UnitTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
          dotnet test ./src/Tests/ProjectName.IntegrationTests/ProjectName.IntegrationTests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
          dotnet build ./src/ProjectName.sln
          dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

I’ve tried re-adding the frontend project to the solution file, so it is at the very end of project list, but that didn’t help. Any ideas why it is failing?

The 5.5.0 version of .NET Sonar Scanner broke something. It was released yesterday, and the last successful build in my pipeline was still using 5.4.1. The first failed was using 5.5.0.

This line in my pipeline config:

dotnet tool install --global dotnet-sonarscanner

is installing the latest “stable” version of a tool, so it is now 5.5.1. I’ve rolled back it to 5.4.1 by changing the command to:

dotnet tool install --global dotnet-sonarscanner --version 5.4.1

and for now, it solved my problem. Hope it will get fixed for good soon.

FYI v5.5.2 of the Scanner for .NET has been released, which should fix the underlying issue.

Hello @Prolog, this seems to be the same issue as Error MSB3677: Unable to move file "/home/vsts/work/1/.sonarqube/out/7/ProjectInfo.xml" to "/ProjectInfo.xml". Access to the path '/ProjectInfo.xml' is denied, indeed. We split your post according to the rules of this forum - our experience shows that each investigation needs its own thread.

After a better look, I believe you should stay on 5.4.1 until we investigate.

I’ve opened https://github.com/SonarSource/sonar-scanner-msbuild/issues/1199 . However I’d need more details to investigate.

Would you be able to provide a minimal reproducer project (I can send a private message if you don’t want to share it). Thanks!

An update @Prolog , we’ve found the root cause of the regression, describes in #1199. It manifests when ErrorLog is explicitly set in your MSBuild configuration.

We’ll prepare a new bugfix release, until then you should either use version 5.4.1 of the scanner, or not set ErrorLog explicitly.

Hi @Prolog

We’ve released the Scanner for .NET 5.5.3.43281 and also the SonarScanner for Azure DevOps. It should fix the error. Please let me know if it doesn’t.

I am still interested in your use case and why you were hitting this error, in order to tell if we have some other regression. While I found the issue in the code and fixed it, I wasn’t able to come up with an E2E test that would simulate a normal user scenario to hit the error.

Would you be willing to discuss this further (maybe in a private thread)?

Thanks,
Andrei

Hi @Andrei_Epure

I’ll bump the version I’m using and will let you know if the issue is gone. Thanks.

Hi @Andrei_Epure

It looks like the 5.5.3 version did the trick. No errors, the pipeline went successful. Thanks for support.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.