title: C# Entity Framework Core: Processing of the LINQ expression failed
body: <h2>The situation</h2>
  <p>We have the following tables in our MySQL database:</p>
  <p>Table club (There are more columns but we only care about the Id for now):</p>
  <pre><code>Id | ...
  ---+----
  1  | ...
  </code></pre>
  <p>Table genre:</p>
  <pre><code>Id | GenreName
  ---+-----------
  1  | Rock
  2  | Classic
  3  | Techno
  </code></pre>
  <p>And table club2genre:</p>
  <pre><code>ClubId | GenreId
  -------+--------
  1      | 1
  1      | 2
  1      | 3
  </code></pre>
  <h2>The MySQL query</h2>
  <p>Using the following MySQL query:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT
      club.Id,
      GROUP_CONCAT(genre.GenreName) as Music
  FROM
      club
  INNER JOIN club2genre
      ON club2genre.clubid = club.id
  INNER JOIN genre
      ON genre.id = club2genre.genreid
  GROUP BY
      club.Id;
  </code></pre>
  <p>we get (as expected) this result:</p>
  <pre><code>Id | Music
  ---+---------
  1  | Rock,Classic,Techno
  </code></pre>
  <h2>The (buggy) C# LINQ expression in question</h2>
  <pre><code>var queryResult = DbContext.Club.Join(
          DbContext.Club2Genre,
          club =&gt; club.Id,
          club2genre =&gt; club2genre.ClubId,
          (club, cg) =&gt; new
          {
              Id = club.Id,
              GenreId = cg.GenreId
          })
      .GroupJoin(
          DbContext.Genre,
          temp =&gt; temp.GenreId,
          genre =&gt; genre.Id,
          (temp, genreList) =&gt; new
          {
              ClubId = temp.Id,
              Genres = genreList.Select(genre =&gt; genre.Name)
          })
      .GroupBy(result =&gt; result.ClubId);
  
  var result = result.ToList();
  </code></pre>
  <p>In theory this Entity Framework Core LINQ expression should be a 1:1 translation of the MySQL query above  where the result column that is aliased as <code>Music</code> (the <code>GROUP_CONCAT</code> one) should be an IEnumerablehowever upon execution the following exception is thrown:</p>
  <p><a href="https://i.stack.imgur.com/LbWQr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LbWQr.png" alt="error" /></a></p>
  <p>Interestingly enough it only fails upon calling <code>ToList()</code> on the <code>queryResult</code> so I'm not even sure the LINQ expression itself is the problem. And (at least for me) the error message doesn't seem to be especially helpful other than essentially saying <code>&quot;EF Core might be buggy but also maybe not. Who knows&quot;</code>.</p>
  <p>So my questions are:</p>
  <p><strong>1.) Is what I'm trying to do even possible using LINQ and EF Core?</strong></p>
  <p><strong>2.) If so, what is wrong my code and why does it crash?</strong></p>
  <p><strong>3.) How do I fix it?</strong></p>