C#

C#

By DeepSource

Audit required: `enum` used for permissions is missing the `Flags` attributeCS-A1004
Bug risk

Flags attribute is generally used when representing multiple values often via bitwise operators. It is recommended that enums used in implementing permissions use this attribute.

Consider discarding empty blocksCS-R1012
Bug risk

Empty blocks do not necessarily add any value to the codebase and should be discarded if possible. Therefore, it is recommended that you either discard this empty block or refactor it accordingly.

Do not throw from critical methodsCS-W1008
Bug risk

Certain methods such as ToString and Dispose are considered to be critical and are expected to work at all times. Throwing exceptions from such methods may interrupt the normal execution of your program. Consider returning an appropriate value instead.

Potential `NullReferenceException` when comparing against `null`CS-W1019
Bug risk
Autofix

The .Equals method works only when the object upon which it is being called is non-null. In case a method such as .Equals is called on an object that is null, a NullReferenceException is thrown. Instead, to check if an object is truly null, consider using the == or != operators instead.

Usage of reserved keywords as variable identifierCS-R1030
Bug risk

Keywords such as async and await have been introduced in C# 5.0 and are called contextual keywords. Contextual keywords have special meaning only in a limited program context and can be used as identifiers outside that context. However, it is recommended that you do not use such keywords as identifiers to avoid confusion.