title: ICollection<string> ValueComparer results in "Argument types do not match"
body: <p>Following the <a href="https://docs.microsoft.com/en-us/ef/core/modeling/value-conversions?tabs=data-annotations#collections-of-primitives" rel="nofollow noreferrer">Collection of Primitives</a> sample code, I've made my own variation:</p>
  <pre class="lang-cs prettyprint-override"><code>public class AttachmentTagsConfiguration : IEntityTypeConfiguration&lt;Attachment&gt;
  {
      public void Configure(EntityTypeBuilder&lt;Attachment&gt; builder)
      {
          builder.Property(e =&gt; e.Tags).HasConversion(
              v =&gt; string.Join( ' ', v.Select(x =&gt; x.ToLower()).Distinct() ),
              v =&gt; v.Split( ' ', StringSplitOptions.RemoveEmptyEntries )
                  .Select( x =&gt; x.ToLower() )
                  .Distinct()
                  .ToList(),
              new ValueComparer&lt;ICollection&lt;string&gt;&gt;(
                  (c1, c2) =&gt; c1.SequenceEqual(c2),
                  c =&gt; c.Aggregate(0, (a, v) =&gt; HashCode.Combine(a, v.GetHashCode())),
                  c =&gt; c.ToList()
              )
          );
      }
  }
  </code></pre>
  <p>Tags have no spaces, so we just join them together in the database to create a single string. This is what the schema looks like:</p>
  <pre class="lang-cs prettyprint-override"><code>public class Attachment
  {
      ...
  
      public ICollection&lt;string&gt; Tags { get; set; }
  }
  </code></pre>
  <p>If I leave the <code>ValueComparer</code> in there, I get the following error when loading a query that has an <code>Attachment</code>:</p>
  <blockquote>
  <p>System.ArgumentException: 'Argument types do not match'</p>
  </blockquote>
  <p>However, if I remove the <code>ValueComparer</code> it works fine. But then I assume change tracking won't work correctly?</p>
  <p>I'm not sure what part of the comparer code could lead to an incorrect argument type. None of the records in the database have a <code>NULL</code> value for <code>Tags</code>, so I don't see how there could be any <code>null</code> values.</p>
  <p><code>Attachments</code> is an ancestor class - we have <code>AssetAttachments</code>, <code>InspectionAttachments</code>, <code>UnitAttachments</code> and <code>DefectAttachments</code>. Does this have an impact on the <code>SequenceEqual</code> comparison?</p>