title: EF Core 5 : must be reducible node
body: <p>after migrating from ef core 3.1 to ef core 5, I encountered this error in executing the following code
  when return IntersectList</p>
  <blockquote>
  <p>System.ArgumentException: 'must be reducible node'</p>
  </blockquote>
  <pre><code>private IQueryable&lt;CategoryBrandDto&gt; ToCategoryBrandDto()
      {
          IQueryable&lt;CategoryBrandDto&gt; Temp = null;
          var categoriesBrands = _context.CategoriesBrands;
          if (categoriesBrands != null)
          {
              Temp = categoriesBrands.Select(c =&gt; new CategoryBrandDto
              {
                  CategoryId = c.CategoryId,
                  BrandId = c.BrandId,
                  Caption = c.Brand.Caption,
                  OriginalCaption = c.Brand.OriginalCaption,
                  ImageUrl = c.Brand.ImageUrl,
                  Arrange = c.Arrange
              });
          }
          return Temp;
      }
  
  public IQueryable&lt;BrandDto&gt; GetIntersectsBrand(IEnumerable&lt;BrandDto&gt; filteredBrand, int categoryId)
      {
          var query = ToCategoryBrandDto().Where(x =&gt; x.CategoryId == categoryId).OrderBy(x=&gt;x.Arrange);
          var selectedList = new List&lt;BrandDto&gt;();
          foreach (var item in query)
          {
              var cb = new BrandDto()
              {
                  BrandDto_BrandId = item.BrandId,
                  BrandDto_Caption = item.Caption,
                  BrandDto_OriginalCaption = item.OriginalCaption,
                  BrandDto_ImageUrl = item.ImageUrl,
                  BrandDto_Arrange = item.Arrange
              };
              selectedList.Add(cb);
          }
          IQueryable&lt;BrandDto&gt; IntersectList = selectedList.AsQueryable().Intersect(filteredBrand, new ComparerBrand());
          return IntersectList;
      }
  </code></pre>
  <p>What should I fix?</p>