Here are peculiar results I get from this simple piece of code.
Say you want to create a variable of type string, without declaring it as a string. You can do this and get no errors from the compiler:
Option Strict On
' Produces no errors:
Dim MyString = "Random String"
You can also do this and not get any errors:
Option Infer Off
' Produce no errors as well.
Dim MyString = "Random String"
But, when you combine both Option String On and Option Infer Off, there is an error:
Option Strict On
Option Infer Off
' The following line generates an error -
' Option Strict On requires all variable declarations to have an "As" clause
Dim MyString = "Random String"
Why does Option Strict need to be combined with Option Infer? Especially when the error specifically says that the following error is an "Option Strict" type. Why can't Option Strict alone find that line as an error?