title: How do I debug XML calls to my ASP.NET Web API?
body: <p>I'm building a simple ASP.NET Web API to receive and post simple data transfer objects (DTO).</p>
  
  <pre><code>public TestDTO Get()
  {
    return new TestDTO();
  }
  
  public void Post([FromBody]TestDTO value)
  {
    var test = value.ToEntity();
  }
  </code></pre>
  
  <p>The TestDTO contains one method <code>ToEntity()</code>, which translates the DTO to an Entity object. </p>
  
  <p>I first do a GET request to get an example DTO, and then POST it back to the service. When I specify <code>Content-Type: application/json</code> in the request headers, everything works fine.</p>
  
  <p>But when I specify <code>Content-Type: application/xml</code>, I <code>GET</code> an example TestDTO fine, but nothing I've tried allows the <code>POST</code> to work. I just get an exception that complains that <code>value</code> is null when it tries to call <code>ToEntity()</code>.</p>
  
  <p>When I try to debug the statement to see why it won't parse the XML, the call stack just contains a reference to <code>[External Code]</code>.</p>
  
  <p>My question is, how do I debug the <code>POST</code> function so I can find out why it won't parse the XML?</p>