Invalid 'Rename this class to remove "Exception" or correct its inheritance'

I started using SonarCloud for one of my open source projects today. Initial analysis pointed me to various Exception classes that do in fact inherit from System.Exception but that inheritance is not detected…

See SonarCloud

Is this a bug?

Hi, @sensslen. Sorry for the late response!
This is indeed a bug in .NET Auto-Scan. The problem is that implicit using are not supported yet.
You have the following options:

  • Mark the issue as False Positive (you already did) and wait for it to be fixed on our end. I have added it to our ToDo list.
  • Add an explicit using by adding using System; to the start of the file.
  • Switch to CI-analysis mode. You can read more about it in the docs.

Thanks for the report; this was an important find!

2 Likes