C# 如何在Visual Studio for Mac中正确提升权限

C# 如何在Visual Studio for Mac中正确提升权限,c#,sockets,.net-core,sudo,visual-studio-mac,C#,Sockets,.net Core,Sudo,Visual Studio Mac,在High Sierra上使用.NET Core 2.1.4,我有以下代码: using System; using System.Net.Sockets; namespace socketTest { class Program { static void Main() { var udpSock = new Socket(AddressFamily.InterNetwork, SocketType.Raw, Proto

在High Sierra上使用.NET Core 2.1.4,我有以下代码:

using System;
using System.Net.Sockets;

namespace socketTest
{
    class Program
    {
        static void Main()
        {
            var udpSock = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Udp);
            Console.WriteLine($"udpSock object is: {udpSock}");

            var tcpSock = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Tcp);
            Console.WriteLine($"tcpSock object is: {tcpSock}");

            Console.WriteLine("Press any key to exit");
            Console.ReadLine();
        }
    }
}
从终端执行:
sudo dotnet socketTest
,输出:

udpSock object is: System.Net.Sockets.Socket
tcpSock object is: System.Net.Sockets.Socket
Press any key to exit
但是,当我从终端(使用
sudo./Applications/VisualStudio.app/Contents/MacOS/VisualStudio
)以提升的权限打开Visual Studio for Mac并尝试运行该程序时,我收到以下错误:

Error: Unable to connect to the specified connection id.
bash: /tmp/tmp339daafd.tmp: Permission denied
如何从Visual Studio for Mac内部正确运行此程序