Why does Visual Studio break System.Net.Socket with each different user session?

213 views Asked by At

I know that I don't have a normal setup, but here it is:

I work in a computer lab, and the computers run on a disk image using Deep Freeze and

Each time you login to Windows 7, I believe that it is initialized each login; user settings are not retained after logout.

  1. I create a new C# 4.0 Console Application Project in Visual Studio 2010 Professional.

  2. I paste the following code:

    using System.Net.Sockets;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            }
        }
    }
    
  3. Ctrl+Shift+S

  4. F5; it runs through and terminates without any errors.

  5. I logout of Windows and login again.

  6. Open project in Visual Studio 2010 Professional.

  7. F5; Argument Exception: http://pastebin.com/pSju1p76

    System.Net.Sockets.SocketException was unhandled
      Message=An invalid argument was supplied
      Source=System
      ErrorCode=10022
      NativeErrorCode=10022
    

What's up with this?

0

There are 0 answers