C#

C#

Made by DeepSource

Methods with DoesNotReturn attribute should not return a value CS-R1003

Anti-pattern
Major
Autofix

A method with the DoesNotReturn attribute suggests that the method does not return anything. Therefore, having return statements inside such methods does not make any sense. Therefore, it is suggested that you refactor your code accordingly, i.e., drop the said attribute or modify your method's logic.

Bad Practice

[DoesNotReturn]
public int NthPrimeNumber(int n)
{
    // ...
}

Recommended

public int NthPrimeNumber(int n)
{
    // ...
}

Reference