title: creating a user in Active Directory: A device attached to the system is not functioning
body: <p>Consider this code attempting to create an Active Directory account. It's generating an exception here with a certain set of data. It's not clear right now what's causing the exception. </p>
  
  <pre><code> var user = new UserPrincipal(someValidUserContext,
                                ".x-xyz-t-FooFooBarTest", "somePwd", true);
  
   user.UserPrincipalName = ".x-xyz-t-FooFooBarTest@foobarbatbaz.net";
   user.SamAccountName = ".x-xyz-t-FooFooBarTest";         
   user.DisplayName = "Some String 16 chars long";
   user.Name =  "Some String 16 chars long";
   user.Description = "Foo BarBaz 12 more characters";
   user.AccountExpirationDate = someDateInFuture;
   user.UserCannotChangePassword = true;
   user.Save();
  
   // exception thrown on Save(): 
   // A device attached to the system is not functioning
  </code></pre>
  
  <p><img src="https://i.imgur.com/OuTXc.png" alt="alt text"></p>
  
  <blockquote>
    <p>PrincipalOperationException was unhandled by user code:
    A device attached to the system is not functioning</p>
  </blockquote>
  
  <p>What's causing this exception, and how can you work around it?</p>