title: Automapper: "Missing type map configuration or unsupported mapping."
body: <p>I got an <code>User</code> and a <code>UserListDto</code>. I'm trying to map my <code>User</code> to <code>UserListDto</code>. </p>
  
  <p>However I'm getting an,</p>
  
  <blockquote>
    <p>Missing type map configuration or unsupported mapping.</p>
  </blockquote>
  
  <p><strong>It works when I call <code>GetUsers()</code> but not <code>GetUser(int id)</code></strong></p>
  
  <p>UsersController:</p>
  
  <pre><code>    [HttpGet]
      public async Task&lt;IActionResult&gt; GetUsers()
      {
          var users = await _repo.GetUsers();
  
          var usersToReturn = _mapper.Map&lt;IEnumerable&lt;UserForListDto&gt;&gt;(users);
  
          return Ok(usersToReturn);
      }
  
      [HttpGet("{id}", Name = "GetUser")]
      public IActionResult GetUser(int id)
      {
          var user = _repo.GetUser(id, false);
  
          var userToReturn = _mapper.Map&lt;UserForListDto&gt;(user);
  
          return Ok(userToReturn);
      }
  </code></pre>
  
  <p>AutoMapperProfiles:</p>
  
  <pre><code>public class AutoMapperProfiles : Profile
  {
      public AutoMapperProfiles()
      {
          CreateMap&lt;User, UserForListDto&gt;();
          CreateMap&lt;User, UserForDetailedDto&gt;();
          CreateMap&lt;UserForRegisterDto, User&gt;();
          CreateMap&lt;HighScoreDto, HighScore&gt;()
          .ForMember(h=&gt;h.TimeBetweenClicksAverage, 
          m=&gt;m.MapFrom(u=&gt;u.TimeBetweenClicksArray.Average()));
          CreateMap&lt;HighScore,HighScoreForReturnDto&gt;();
  
  
  
      }
  }
  </code></pre>
  
  <p>User:</p>
  
  <pre><code>public class User : IdentityUser&lt;int&gt;
  {
      public virtual ICollection&lt;UserRole&gt; UserRoles { get; set; }
      public virtual ICollection&lt;HighScore&gt; HighScores { get; set; }
  }
  </code></pre>
  
  <p>UserForDetailedDto:</p>
  
  <pre><code>public class UserForDetailedDto
  {
      public int Id { get; set; }
      public string Username { get; set; }
  }
  </code></pre>