PVS-Studio static analyzer was run against the S&Box game engine codebase (Facepunch's open-source C# 14 / .NET 10 project). The post walks through several real bugs found: a self-comparison typo in an if-condition, operator precedence confusion between ?? and &&, a potential NullReferenceException from a null-conditional operator result passed to a non-null-safe overload, a LINQ Where result that's never iterated due to deferred execution, a redundant StartsWith check, a forgotten use of a Deserialize return value, commented-out TODO logic left in a release, an int vs float deadzone comparison, and a string.Format argument count mismatch. Each finding is explained with code snippets and the relevant PVS-Studio warning code.

Sort: