This function validates the given host name by actually trying to create a Uri object and seeing if it fails. It also has to construct and allocate a string to pass to the Uri.TryCreate method.
We should be able to validate a hostname directly, without actually constructing a Uri.
The main place this is used is when setting the Host property on the request message headers.