ConsoleBase - NKS0006
Use ReadLine() from InputTools
This analyzer provides the following strings:
Context | String |
---|---|
Error List | Caller uses |
Suggestion Box | Use |
Description |
|
Extended Description
This code analyzer detects the usage of ReadLine
from the standard Console
class found in the System
namespace. While this function brings some of the awesome features, such as the history and the positioning, they are limited in terms of flexibility.
Historically, it had problems with Mono on Linux not playing nice with these features, causing the console to register an incorrect character to the buffer, messing things up in the process. This was one of the outstanding issues that we had to deal with during the development of 0.0.16.0 in 2021.
The ReadLine()
provided by Nitrocid KS is a wrapper to Terminaux's console input reader feature, except that the settings are managed by Nitrocid KS and that their histories are saved once the kernel shuts down, further allowing flexibility.
Analysis Comparison
To get a brief insight about how this analyzer works, compare the two code blocks shown to you below:
Before the fix
After the fix
Suppression
You can suppress this suggestion by including it in the appropriate place, whichever is convenient.
For more information about how to suppress any warning issued by the Nitrocid analyzer, visit the below page:
Recommendation
We recommend that every caller which use this property use the recommended abovementioned method.