title: How to detect missing domain controller in advance of identity translation?
body: <p>In our codebase we have a chunk of code that makes some decisions based on the current user's memberships. Vastly simplified it looks like this:</p>
  
  <pre><code>foreach (var group in WindowsIdentity.GetCurrent().Groups)
  {
      try
      {
          string groupName = group.Translate(typeof(NTAccount)).Value;
          if (groupName.StartsWith(..blahblahblah...)) { dosomething(); }
      }
      catch (IdentityNotMappedException) { }
  }
  </code></pre>
  
  <p>Unfortunately I'm on a laptop outside the LAN and it's not handling the offline case. The <code>Translate()</code> call fails with a SystemException <em>"The trust relationship between this workstation and the primary domain failed."</em></p>
  
  <p>I don't want to mask <code>SystemException</code> for obvious reasons, and I definitely don't want to disable first-chance catching those in the debugger.</p>
  
  <p>What is the correct way to test for Translate() failing due to the domain controller being unreachable?  I don't want to mask the specific "trust relationship failed" error, just avoid attempting the Translate if it is guaranteed to fail due to network conditions.</p>