title: Asp.net core 2.2 web api FromForm of complex object contains only null values
body: <p>Hi I am trying to build an endpoint for slack commands in asp.net core 2.2.
  I have a data structure representing a commandrequest from slack like so:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    public class SlackCommandDTO
      {
          [FromForm(Name = "token")]
          public string Token { get; set; }
  
          [FromForm(Name = "team_id")]
          public string TeamId { get; set; }
  
          [FromForm(Name = "team_domain")]
          public string TeamDomain { get; set; }
  
          [FromForm(Name = "channel_id")]
          public string ChannelId { get; set; }
  
          [FromForm(Name = "channel_name")]
          public string ChannelName { get; set; }
  
          [FromForm(Name = "user_id")]
          public string UserId { get; set; }
  
          [FromForm(Name = "user_name")]
          public string UserName { get; set; }
  
          [FromForm(Name = "command")]
          public string Command { get; set; }
  
          [FromForm(Name = "text")]
          public string Text { get; set; }
  
          [FromForm(Name = "response_url")]
          public string ResponseUrl { get; set; }
  
          [FromForm(Name = "trigger_id")]
          public string TriggerId { get; set; }
      }
  </code></pre>
  
  <p>My controller to receive data looks like this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    [Route("api/[controller]")]
      [ApiController]
      public class CustomerServiceController : ControllerBase
      {
          // POST api/customerservice
          [HttpPost]
          public void Post([FromForm] SlackCommandDTO command)
          {
              Console.Write(command.Token);
          }
      }
  </code></pre>
  
  <p>my startup.cs looks like this</p>
  
  <pre class="lang-cs prettyprint-override"><code>    public class Startup
      {
          public Startup(IConfiguration configuration)
          {
              Configuration = configuration;
          }
  
          public IConfiguration Configuration { get; }
  
          // This method gets called by the runtime. Use this method to add services to the container.
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IHostingEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
  
              app.UseMvc();
          }
      }
  </code></pre>
  
  <p>I have tried setting the compatability settings in startup.cs to 2.1 and 2.2.</p>
  
  <p>The result is always an instance of the object that contain null in all properties.</p>
  
  <p>I have tried setting the decorator to [FromBody] (not that that is supposed to work) but in that case I get 415 unsupported media type (as it should).</p>
  
  <p>I have tried sending the requests with content-type x-www-form-urlencoded and form-data as well as text/plain and application/json. the latter two return 415.</p>
  
  <p>I have also tried sending the request through swagger with the same result and curl both using -d keyword and -F keyword for each pair of data.</p>
  
  <p>If I am missing some information please let me know, I am drawing a blank here on how to solve it so please help.</p>
  
  <p>The data I am receiving is from Slack according to this article about implementing slash commands in slack.
  <a href="https://api.slack.com/slash-commands#responding_to_commands" rel="nofollow noreferrer">https://api.slack.com/slash-commands#responding_to_commands</a></p>