for
loop due to stackalloc
CS-W1025A stackalloc
expression allocates a block of memory on the stack and is cleaned up only when the controller exits the method. Placing a stackalloc
expression inside a loop continuously allocates memory and does not let it get discarded despite the controller exiting the loop's scope. It is therefore recommended that you rethink your approach.
default
label without a comment is redundant CS-R1022The default
case in a switch
is executed when none of the provided cases match. An empty default
case without a user comment is redundant. Either add a user comment to indicate to the reader and the analyzer that all the possible cases have been covered, or, consider throwing a NotImplementedException
to indicate that some cases are yet to be handled.
public
class per namespace CS-R1035Having more than 1 public class per namespace increases the complexity and affects the overall code readability and navigation. It is therefore recommended that you have a single public
class per namespace
.
DangerousGetHandle
CS-A1001Handle returned by DangerousGetHandle
can be invalidated, become stale, or be recycled when APIs such as SetHandleAsInvalid
is invoked. This can lead to potential security vulnerabilities within your application. It is therefore recommended that you use this method only if you know what you're doing and absolutely require it.
The [Ignore]
attribute is used to ignore a specific test's final result. This is usually done in situations where the test is failing, either due to the fault in the test itself, or that the logic that is being tested is at fault and is not behaving as per requirement. Because this indicates a potential flaw within your application, it is recommended that you fix it as soon as possible.