title: How do I debug this first chance exception on a Socket?
body: <p>In my C#/WPF/.Net 4.5 program I'm trying to do a <em>Disconnect()</em> on a socket and when I do I get a</p>
  
  <blockquote>
    <p>A first chance exception of type 'System.Net.Sockets.SocketException'
    occurred in System.dll</p>
  </blockquote>
  
  <p>. . . in the Visual Studio Output window. </p>
  
  <p>My code is wrapped in a try/catch but it never lands in the catch . . . </p>
  
  <pre><code>    try
        {
            if (_TCPConn.Connected)
            {
                _TCPConn.Shutdown(SocketShutdown.Both);
                _TCPConn.Disconnect(true);   // SocketException
            }
        }
        catch (Exception e)
        {
     . . . 
        }
  </code></pre>
  
  <p>Up until this point the Socket works fine -  it's used to communicate with some manufacturing machinery and all that stuff works perfectly.   I've tried this with and without the <em>Shutdown()</em> with the same results.   If I let my program keep running after the first chance exception the whole program just disappears and exits the debugger. Then the message in the Output window just says </p>
  
  <blockquote>
    <p>The program '[0xE6C] ProcFacTest.vshost.exe: Managed (v4.0.30319)' has
    exited with code 0 (0x0).</p>
  </blockquote>
  
  <p>How do I figure out what's causing this?</p>