You need to enable JavaScript to run this app. Visual Studio for Mac开发的C#项目偶发ExtendedSocketException如何解决
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.11.02 06:54:03