Home > Blockchain >  IAsyncEnumerable won't resolve with reference to Entity Framework Core
IAsyncEnumerable won't resolve with reference to Entity Framework Core

Time:04-30

I have some code with the following signature

IAsyncEnumerable<string> GetLines(string filePath)

This resolves fine using

System.Collection.Generic

Great.......

However when I add the package for Entity Framework Core, it suddenly won't resolve.

The error I get is:

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'

Can someone please enlighten me as to why this is happening so I can understand it and also help me to resolve this issue?

Thanks!

CodePudding user response:

It's just a confusion when a type exists in multiple namespace thus compiler doesn't know which should it use.

So you can simply resolve it by specifying the namespace:

System.Collection.Generic.IAsyncEnumerable GetLines(string filePath)

  • Related