Here is a direct port of the C# code into VB.NET:
Public Shared Function ShannonEntropy(s As String) As Double
Dim map = New Dictionary(Of Char, Integer)()
For Each c As Char In s
If Not map.ContainsKey(c) Then
map.Add(c, 1)
Else
map(c) += 1
End If
Next
Dim result As Double = 0.0
Dim len As Integer = s.Length
For Each item As var In map
Dim frequency = CDbl(item.Value) / len
result -= frequency * (Math.Log(frequency) / Math.Log(2))
Next
Return result
End Function
If the C# code produces the results you were looking for, this code will give the same results.