Problem scanning .NET 8 targeted projects on MacOS

Hi again,

I have more information to provide and a temporary workaround.

I can finally reproduce the issue on my macOS machine, and I confirm it comes from this breaking change of GetFolderPath, introduced in .NET 8 Preview 1. If you are interested in the details, you can find more information about it here and here.

In the specific case of the Sonar Scanner, the issue only appears when a previous version of .NET (e.g. .NET 7) has been installed on the machine and the scanner has been run against that version. I could not reproduce the issue before because, on my machine, I hadn’t run the Scanner with a previous version of .NET. Therefore, I had no files under /Users/youruser/.local/share/Microsoft/MSBuild.

A quick temporary workaround that should fix the issue is to move the directory /Users/youruser/.local/share/Microsoft/MSBuild to /Users/youruser/Library/Application Support/Microsoft/MSBuild, and then rerun the analysis.

I am now checking why the Sonar Scanner gets stuck on using /Users/youruser/.local/share/Microsoft/MSBuild, when that is present on the disk, despite LocalApplicationData pointing to the Library/Application Support location.

Hope it helps,
Antonio

4 Likes