Skip to content

System.Interactive.Async call is ambiguous error when IX-Async is referenced #18124

@shravan2x

Description

@shravan2x

I'm using .NET Core 3.0 with EF Core and System.Interactive.Async. Using methods like FirstOrDefaultAsync and Where results in compilation errors like

The call is ambiguous between the following methods or properties: 'Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.FirstOrDefaultAsync<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.Expression<System.Func<TSource, bool>>, System.Threading.CancellationToken)' and 'System.Linq.AsyncEnumerable.FirstOrDefaultAsync<TSource>(System.Collections.Generic.IAsyncEnumerable<TSource>, System.Func<TSource, bool>, System.Threading.CancellationToken)'
The call is ambiguous between the following methods or properties: 'System.Linq.Queryable.Where<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.Expression<System.Func<TSource, bool>>)' and 'System.Linq.AsyncEnumerable.Where<TSource>(System.Collections.Generic.IAsyncEnumerable<TSource>, System.Func<TSource, bool>)'

Steps to reproduce

  1. Reference EFCore.
  2. Reference System.Interactive.Async
public class FruitDb : DbContext
{
    public DbSet<Apple> Apples { get; set; }

    public async Task Seeds5Async()
    {
        Apple apple = await Apples.FirstOrDefaultAsync(x => x.NumSeeds == 5);
        // ... use it
    }
}

Further technical details

EF Core version: 3.0.0
Database provider: Sqlite
Target framework: .NET Core 3.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.3

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions