Last analysis ID: "AZkLaw0LUHHgP5YiFaY0"

trying to run automatic analysis for a .NET project on GitHub

Hi @ale-assetworks ,

Welcome to the Community.

I found this error message in the logs:

ERROR: System.ArgumentException: An item with the same key has already been added. Key: /tmp/clone10368097792658420565/m5Batch/M5CEFix/M5CEFix.csproj

Does this error tell you anything? Is it possible that this C# dependency is imported more than once?

Cheers,

Javier

Hi @ale-assetworks,

Can you check if this file exists in your repository (not necessary in your .NET solution) also under different casing - either in directory name or filename? Something like

/m5Batch/M5CEFix/M5CEFix.csproj
/m5Batch/M5CEFix/M5CeFix.csproj
/M5Batch/M5CEFix/M5CEFix.csproj

It would help us to confirm the root cause of the issue and fix it.

Thank you

yes, it exists in my repo

still getting this issue: he following failing analysis ID: “5866942b-0f9a-408f-8131-9de1ec54b1fb”.

I’ve crated an internal ticket for this. But it was not fixed yet.

Is cleaning up your repo and removing or renaming one of those csproj files an option? Having different casings for csproj files inside .NET project does not sound like a good practice in general.

In case this is not an option, you can switch from AutoScan analysis to a CI-based analysis in your pipelines. The best that AutoScan could do will be to randomly ignore one of those csproj files completely. And if they are not in sync, that can lead to worse analysis results.

I’ve removed the problematic files as suggested, but unfortunately, the issue still persists. (attached image)

Hi,

Exclusions use glob patterns, so ** means 0-n directories. * means all files. Can you try ending your patterns with **/*?

 
Ann

done. Now the error code is 2ec85f79-0bf0-444a-a41a-6f36181fcf1a

Hi,

Then the answer is the same. You’ll need to switch to CI-based analysis so you can more closely control how your analysis runs.

And/or you could try excluding the files that were cited above as being the problem:

.NET is case-sensitive, but analysis is not. So while these are different paths on windows, for us they’re duplicate files.

 
Ann

1 Like

Exclusions will not help here, unfortunately (TL; DR; below). You’d need to rename or remove the duplicate CSPROJ file(s) from the repo. Or use CI-based analysis.

Can you tell us why do you have such CSPROJ files (with the same name, just different casing), in your project? Like what is the purpose, what problem does it solve. I would help us understand your scenario and improve our products.


TL; DR;
These exclusions affect what is analyzed in terms of “if we have file, we decide if we run analysis on it or not, and/or, if we actually push those issues up to the SonarQube Cloud”.

AutoScan needs to reconstruct your project to perform Roslyn-based analysis on it. The error happens during this project reconstruction, before the actual analysis will start.