Visual Studio for Mac开发的C#项目偶发ExtendedSocketException如何解决
问题描述
在Visual Studio for Mac中使用C#开发项目,程序运行状态不稳定,偶发运行失败。关联的实现代码如下:
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(); } } }
异常相关信息
- 异常触发模块:
System.Net.NameResolution.dll - 异常类型:
System.Net.Internals.SocketExceptionFactory.ExtendedSocketException - 控制台日志提示:运行过程中上述类型的异常被运行时自动触发
若定位问题需要更多细节,可随时告知
内容的提问来源于stack exchange,提问作者mmk
相关产品推荐
相关产品推荐

