title: Windows Authentication - Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
body: <p>I have just started using Retrace by stackify to monitor my application and have seen thousands of errors which are:</p>
  
  <pre><code>System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
  at System.Guid.TryParseGuidWithNoStyle
  at System.Guid.TryParseGuid
  at System.Guid..ctor
  at System.DirectoryServices.AccountManagement.ADStoreCtx.IdentityClaimToFilter
  </code></pre>
  
  <p>These errors are happening thousands of times a day and I can't work out quite why. Firstly, my application works like so:</p>
  
  <p>MVC front end - using Windows Authentication (using RestSharp to call backend)</p>
  
  <p>Web API back end, using Windows Authentication passed from RestSharp NTLM Authentication.</p>
  
  <p><strong>RestSharp wrapper</strong></p>
  
  <pre><code>    public object WebRequest&lt;T&gt;(string controller, Dictionary&lt;string, string&gt; parameters, Method apiMethod, string action)
      {
          RestClient client = new RestClient(Url + controller + "/");
          client.Authenticator = new NtlmAuthenticator();
          RestRequest request = new RestRequest(action, apiMethod);
  
          if (parameters != null &amp;&amp; parameters.Count &gt; 0)
          {
              foreach (var parameter in parameters)
              {
                  request.AddParameter(parameter.Key, parameter.Value);
              }
          }
  
          object result = JsonToObject&lt;T&gt;(client.Execute(request).Content);
  
          return result;
      }
  </code></pre>
  
  <p><strong>Helper Methods</strong></p>
  
  <pre><code>@helper Username()
  {
  PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
  
   var username = System.Web.HttpContext.Current.User.Identity.Name.Replace(@"DOMAIN\", "");
  
  @username
  }
  
  @helper UserFullName()
  {
      using (var context = new PrincipalContext(ContextType.Domain))
      {
          var principal = UserPrincipal.FindByIdentity(context, User.Identity.Name);
          if (principal != null)
          {
              var fullName = string.Format("{0}", principal.DisplayName);
              @fullName
          }
      }
  }
  </code></pre>
  
  <p>Any suggestions on where this error may be happening or what I can do to narrow it down? It seems to happen on every page from what I can tell in Stackify.</p>