![JAR search and dependency download from the Maven repository](/logo.png)
org.sonar.plugins.csharp.S3449.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonarlint-omnisharp-plugin Show documentation
Show all versions of sonarlint-omnisharp-plugin Show documentation
Code Analyzer based on Omnisharp
Why is this an issue?
Numbers can be shifted with the <<
and >>
operators,
but the right operand of the operation needs to be an int
or a type that has an implicit
conversion to int
. However, when the left operand is dynamic, the compiler’s type checking is turned
off, so you can pass anything to the right of a shift operator and have it compile. And if the argument can’t be implicitly converted to
int
at runtime, then a RuntimeBinderException will be
raised.
dynamic d = 5;
var x = d >> 5.4; // Noncompliant
x = d << null; // Noncompliant
x <<= new object(); // Noncompliant
Resources
Documentation
© 2015 - 2025 Weber Informatics LLC | Privacy Policy