Static hashTimeDifferrence As HashSet(Of String) = New HashSet(Of String)
works fine
Static hashTimeDifferrence = New HashSet(Of String)
doesn't
Dim hashTimeDifferrence2 = New HashSet(Of String)
works because option infer is on.
I think it should work for dim and static.
Is this a bug in vb.net?
There is no fundamental reason why, it is actually just a missed edge case from when Infer was introduced. The former VB PM Anthony Green used it as a reference in how to make breaking changes: https://github.com/dotnet/vblang/issues/312