Test project execution is failing if SonarQube prepare task added in the pipeline

I am trying to get the analysis from pipeline yml, I used SonarQube to get the coverage results, but its failing in the test project build.

Error Message:
System.InvalidOperationException : XXXX doesn’t look like a Refit interface. Make sure it has at least one method with a Refit HTTP method attribute and Refit is installed in the project.
Stack Trace:
at Refit.RestService.GetGeneratedType(Type refitInterfaceType) in //Refit/RestService.cs:line 100
at Refit.RestService.For(Type refitInterfaceType, HttpClient client, IRequestBuilder builder) in /
/Refit/RestService.cs:line 36
at Refit.RestService.For[T](HttpClient client, IRequestBuilder`1 builder) in //Refit/RestService.cs:line 13
at Refit.RestService.For[T](HttpClient client, RefitSettings settings) in /
/Refit/RestService.cs:line 20
at Refit.RestService.For[T](String hostUrl, RefitSettings settings) in /_/Refit/RestService.cs:line 27
"
SonaQube Task

  • task: SonarQubePrepare@4.11.0
    inputs:
    SonarQube: ‘SonarQube’
    scannerMode: ‘MSBuild’
    projectKey: ‘Key’
    projectName: ‘Name’
    projectVersion: ‘$(GitVersion.SemVer)’
    extraProperties: |
    sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/coverage.opencover.xml

Test Project Task

  • task: DotNetCoreCLI@2
    displayName: Run Tests
    inputs:
    command: ‘test’
    projects: ‘**/[Tt]ests/.csproj’
    arguments: ‘–configuration $(buildConfiguration) --collect:“XPlat Code Coverage” – DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura,opencover’

Note : Refit package version - 6.0.38

Did I missed anything? Please share your thoughts

Hi @rajeshbalaji ,

Welcome to SonarSource Community :sonarsource: !

I don’t know much about Refit, but please make sure to upgrade to the latest version of Sonar scanner for Azure DevOps and use SonarQube 8.9.1, and please add sonar.verbose=true to the extraProperties key in SonarQubePrepare step and share the Azure DevOps logs here.

Joe

Hi Joe, Sorry for delay in the response. After updating the version issue resolved. Thanks

1 Like

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