Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Interactive.Async dependency breaks .NET Core 3.0 IAsyncEnumerator in .NET Core 3.0 preview 3 #15047

Closed
Zenexer opened this issue Mar 15, 2019 · 19 comments

Comments

@Zenexer
Copy link

Zenexer commented Mar 15, 2019

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' 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

@Zenexer Zenexer changed the title System.Interactive.Async dependency breaks IAsyncEnumerator System.Interactive.Async dependency breaks .NET Core 3.0 IAsyncEnumerator in .NET Core 3.0 preview 3 Mar 16, 2019
@Zenexer
Copy link
Author

Zenexer commented Mar 16, 2019

Forcefully adding a dependency for System.Interactive.Async >= 4.0.0-preview* works around the issue, but I don't think it makes sense for EF Core 3.0.0-preview* to depend on System.Interactive.Async >= 3.2.0 when it really needs >= 4.0.0-preview*.

@ajcvickers
Copy link
Contributor

@smitpatel to follow up.

@smitpatel
Copy link
Contributor

Duplicate of #14239

The thread has steps to get it to work.

@smitpatel
Copy link
Contributor

For the 2nd comment duplicate of #14906

@lucaswalter
Copy link

I am still currently running into this issue with EF Core 3.0. Is the suggested solution still to forcefully update System.Interactive.Async >= 4.0.0?

@shelbypereira
Copy link

shelbypereira commented Oct 29, 2019

I also have this issue in Core 3.0.

forcefully updating to System.Interactive.Async 4.0.0 only helped partially. The error went away, but now I have another error:
Reference to type 'IAsyncEnumerable<>' claims it is defined in 'System.Interactive.Async', but it could not be found

I have a test class:
internal class TestAsyncQueryProvider : IAsyncQueryProvider

and it seems that IAsyncQueryProvider is causing the issue.

NOTE: I also tried forceably updating to System.Runtime 4.3.1 which did not help.

@ajcvickers
Copy link
Contributor

@shelbypereira Make sure that older versions of the IX package is not being referenced from somewhere. Likewise, make sure that all EF/Extensions/ASP.NET packages are updated to 3.0 versions. Also, be aware that starting with .NET Core 3.0, some types are now implemented by the .NET Core base class library due do support for async enumerations in the C# 8 compiler.

@shelbypereira
Copy link

Thanks, your sugestion works, I actually did not have EF Core referenced, it seems I did not need it in .net Core, adding the reference to EF 3.0 worked.

@ZombiesWithCoffee
Copy link

Once I added System.Interactive.Async 4.0 - I now get

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

@AnotherZane
Copy link

Once I added System.Interactive.Async 4.0 - I now get

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

Same thing happens to me

@Donis-
Copy link

Donis- commented Nov 20, 2019

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

@rui-ktei
Copy link

I came across this error just now. I'm using .netcoreapp3.1 and simply using IAsyncEnumerable 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.

@ghost
Copy link

ghost commented Feb 10, 2020

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' 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

@rui-ktei
Copy link

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?

@klis70
Copy link

klis70 commented Jul 26, 2020

_

Project in .net core 3.1

Using System.Interactive.Async latest version 4.1.1 I had the same problem.
Installing version 3.2.0 it worked.

@roji
Copy link
Member

roji commented Aug 30, 2020

For anyone running into this issue, if none of the solutions above work, the best way forward is to post a runnable code sample (including your csproj) in a new issue, and we'll investigate and assist. Unfortunately there isn't much we can do with a report that doesn't include a sample.

@Bitfiddler
Copy link

I have the same issue, using .Net core 3.1, my project has AddAssemblyAliasToReactiveAsync xml in csproj, still the compiler is confused as to which IAsyncEnumerable to use. Sample attached.
Sample.zip

@Bitfiddler
Copy link

Ok, so this may help someone... check all your various packages for references to Microsoft.EntityFrameworkCore.Relational.

In my case I had 2 different packages referencing that package. First one was Microsoft.EntityFrameworkCore.Tools. I installed that first and it installed the most recent version of this library.

Later I installed Oracle.EntityFrameworkCore which also reverences the ...Core.Relational package, but it references 2.1.1 (or something old anyway). It seems like installing that package updates your solution to always point to that old package and hence you get a compile error.

To work around this, uninstall both the .Tools and Oracle packages, then install the latest version of the .Relational package directly (this will lock that version from being over-ridden) then install the other packages.

@Bitfiddler
Copy link

Turns out the current stable version of Oracle.EntityFrameworkCore doesn't work with Core 3.1 so I had to switch to the pre-release Beta2. Seems to work though and for the Proof-of-concept I'm working on this will be fine. Will have to wait to go forward with core 3.1 until Oracle catches up.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests