C#

C#

Made by DeepSource

Custom Exceptions should always be public CS-W1004

Bug risk
Major

Exceptions are not limited to a part of the codebase and can be thrown and caught anywhere. It is therefore recommended that your custom Exceptions always be declared as public. Otherwise, you'd have to catch the closest accessible public exception.

Bad practice

internal class MyCustomException: Exception
{
}

Recommended

public class MyCustomException: Exception
{
}

References: