efcore: System.Interactive.Async dependency breaks .NET Core 3.0 IAsyncEnumerator in .NET Core 3.0 preview 3

Currently, Microsoft.EntityFrameworkCore 3.0.0-preview3.19153.1 requires System.Interactive.Async 3.2.0. However, both System.Interactive.Async 3.2.0 and .NET Core 3.0 provide System.Collections.Generic.IAsyncEnumerator`1, preventing projects that use IAsyncEnumerator from building:

Severity Code Description Project File Line Suppression State Error CS0433 The type ‘IAsyncEnumerator<T>’ exists in both ‘System.Interactive.Async, Version=3.2.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263’ and ‘System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ Test.Services E:\Source\Test\Test\Test.Services\Import\Enumerator\AgnosticEnumerator.cs 10 Active

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (5 by maintainers)

Most upvoted comments

I came across this error just now. I’m using .netcoreapp3.1 and simply using IAsyncEnumerable<T> interface gave me this error straightaway. If I’m not missing anything here then this error is kinda embarrassing for a production .net core release.

why is it SO HARD to use IAsyncEnumerable? I also encountered the same problem. I’m using .net core 3.0 by the way:

TypeLoadException: Could not load type ‘System.Collections.Generic.IAsyncEnumerable`1’ from assembly ‘System.Interactive.Async, Version=4.1.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263’.

It’s very frustrating and why do I even have to spend time searching everywhere to find how to a framework level API? Isn’t it supposed to work out of the box?

For runtime error “TypeLoadException: Could not load type ‘System.Collections.Generic.IAsyncEnumerable`1’ from assembly ‘System.Interactive.Async, Version=4.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263’.”

Remove the explicit addition of dependency to System.Interactive.Async 4.0 (as it does not have the type anymore and indirectly references it from Microsoft.Bcl.AsyncInterfaces)

And add to .csproj:

  <Target Name="AddAssemblyAliasToReactiveAsync"
          AfterTargets="ResolveAssemblyReferences">
    <ItemGroup>
      <ReferencePath Condition=" '%(FileName)' == 'System.Interactive.Async' ">
        <Aliases>reactive</Aliases>
      </ReferencePath>
    </ItemGroup>
  </Target>

Inspired by comment in #14239, and corresponding reference to: https://github.com/aspnet/EntityFrameworkCore/blob/v3.0.0-preview4.19216.3/Directory.Build.targets

I use EF2 in a separate library which i reference in the main project, and i can not use IAsyncEnumerable after that. It must be compatible with Net.Core 3.1, but it does not. I use it - because EF2.0 works with SQL 2008, but EF3.1 does not work.

Severity Code Description Project File Line Suppression State Error CS0433 The type ‘IAsyncEnumerable<T>’ exists in both ‘System.Interactive.Async, Version=3.2.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263’ and ‘System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ PumpWeb C:\DATA\NEW_SVM\NSIWEB2\APPLICATION\pumpMVC\PumpWeb\Utils\XmlGenResult.cs 29 Active

Duplicate of #14239

The thread has steps to get it to work.

For the 2nd comment duplicate of #14906