Here is a very popular problem that many VB developers fail to see. Furthermore, it is hard to find once in the code. Can you spot it?
imports Microsoft.VisualBasic
imports System
public module MyModule
sub Main
dim a as integer = 0
dim b as integer = CInt(iif(a=0, 100, SomeCalc(a)))
end sub
private function SomeCalc(a as integer) as integer
if a = 0 then
throw new ArgumentNullException("a")
else
return CInt(100 / a)
end if
end function
end module