Operation canceled due to exceeding execution time

Hi,

I’m trying to scan a .NET 4.8 project (<100K LOC) using github action. There are no errors, but the “Build and analyze” step is taking hours. The only thing I’ve spotted in 700 lines of logs is a failed build:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3374,5): warning MSB5021: Terminating the task executable "lc" and its child processes because the build was canceled.
Done Building Project "D:\a\aat\aat\XXX\XXX.sln" (Rebuild target(s)) -- FAILED.
Done Building Project "D:\a\aat\aat\XXX\src\YYY\YYY.csproj" (Rebuild target(s)) -- FAILED.
Build FAILED.

However, I don’t know if this is what caused the long duration and there’s no indication to what cause the build to fail. Please, how can I troubleshoot ?

Thanks in advance

Hey there.

How is your GitHub Actions YML file configured? I suggest pasting it here.

Thanks for your quick reply. Here it is:

name: Build
on:
  push:
    branches:
      - main
  pull_request:
    types: [opened, synchronize, reopened]
jobs:
  build:
    name: Build
    runs-on: windows-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  # Shallow clones should be disabled for a better relevancy of analysis
      - name: Cache SonarCloud packages
        uses: actions/cache@v1
        with:
          path: ~\sonar\cache
          key: ${{ runner.os }}-sonar
          restore-keys: ${{ runner.os }}-sonar
      - name: Cache SonarCloud scanner
        id: cache-sonar-scanner
        uses: actions/cache@v1
        with:
          path: .\.sonar\scanner
          key: ${{ runner.os }}-sonar-scanner
          restore-keys: ${{ runner.os }}-sonar-scanner
      - name: Install SonarCloud scanner
        if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
        shell: powershell
        run: |
          New-Item -Path .\.sonar\scanner -ItemType Directory
          dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
          
      - name: Add msbuild to PATH
        uses: microsoft/setup-msbuild@v1.1
        
      - name: Add nuget to PATH
        uses: Nuget/setup-nuget@v1.0.5
        
      - name: Restore nuget packages
        run: nuget restore .\XXX\XXX.sln
        
      - name: Build and analyze
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_DOTNET_ENABLE_CONCURRENT_EXECUTION: true
        shell: powershell
        run: |
          .\.sonar\scanner\dotnet-sonarscanner begin /k:"ZZZ" /o:"ZZZ" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"          
          MSBuild.exe .\XXX\XXX.sln /t:Rebuild
          .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

Thanks.

If you remove .\.sonar\scanner\dotnet-sonarscanner begin and .\.sonar\scanner\dotnet-sonarscanner end, do you still encounter the build failure or long duration?

Yes, it seems the problem persists. I’ve added the reportanalyzer property, and it seems that the compiler is stuck processing a licx file. I’ve no idea why and, unfortunately, I don’t have time to debug it. It’s frustrating as it works perfectly in VS.

If your build still gets stuck / fails without SonarCloud steps there… unfortunately I don’t think we’ll be able to be much help. :confused:

Once you have a working build in GitHub Actions, the SonarCloud steps should be able to slide right in and provide the analysis.