I've been getting all turned around regarding this section of code. The NullReferenceException only occurs at runtime.
Public Sub SendData(ByVal b As String)
Dim data(2048) As Byte
data = System.Text.Encoding.ASCII.GetBytes(b)
stream.Write(data, 0, data.Length)
End Sub
The intent is take a string, and stream the bytes of the string over to another computer. The stream.Write portion of the code is what's throwing the NullReferenceException part. However, I checked through debugging that the data portion does get the bytes from the Encoding portion of the code. So I'm not sure why it's throwing the NullReferenceException.