I have a project developed in C# using Visual Studio for mac. Unfortunately it works fine sometimes & failed sometimes. The code and the exception as follows.
How can I resolve this?
public static class ServerSettings
{
public static string Version = "xxx";
public static string[] IpAddresses
{
get
{
var hostName = Dns.GetHostName();
var ipHostEntry = Dns.GetHostEntry(hostName);
return ipHostEntry.AddressList
.Where(a => a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
.Select(a => a.ToString())
.ToArray();
}
}
}
Console Log:
Exception thrown: 'System.Net.Internals.SocketExceptionFactory.ExtendedSocketException' in System.Net.NameResolution.dll
If you need more details please let me know.
In my case inside the machine name there were Japanese characters(something like MMKのMacBook) which caused the problem.
This may be a stupid answer but, after removing those Japanese characters I could able to manage the successful connection with the server.
Thank you for your suggestions.