Invalid program exception in release build (.NET 4.6.1)
问题 I have a program that deals with socket communication asynchronously. The exception I've been getting only occurs in release build (on build machines). The code that causes the problem is really simple routine to start listening for incoming socket connections: public async Task Listen() { try { var endpoint = new IPEndPoint(IPAddress.Loopback, Port); using (Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { Socket.Bind(endpoint); Socket.Listen(Limit);