Efcore: EF Core 3.0 - Could not load file System.Interactive.Async

Created on 16 Oct 2019  路  8Comments  路  Source: dotnet/efcore


I get this error after upgrade .NET Core 2.2 to .NET Core 3.0 and upgrade all package
System.IO.FileNotFoundException: Could not load file or assembly 'System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'

Exception Message:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'. O sistema n茫o pode encontrar o arquivo especificado.
File name: 'System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'
at LinqKit.Extensions.AsExpandableT
at LinqKit.Extensions.AsExpandableT in C:\tdsasistemas\projetos\healther\backend\src\Healther\Modules\Domain\Commands\Usuario\Handler\UsuarioCommandHandler.cs:line 53
at Healther.Application.Services.UsuarioApplicationService.RealizaLoginAsync(Nullable1 idUsuario, String login, String senha) in C:\tdsasistemas\projetos\healther\backend\src\Healther\Modules\Application\Services\UsuarioApplicationService.cs:line 42 at Healther.Api.Base.Security.AuthorizationProvider.HandleTokenRequest(HandleTokenRequestContext context) in C:\tdsasistemas\projetos\healther\backend\src\Healther\Api\Base\Security\AuthorizationProvider.cs:line 46 at AspNet.Security.OpenIdConnect.Server.OpenIdConnectServerHandler.InvokeTokenEndpointAsync() at AspNet.Security.OpenIdConnect.Server.OpenIdConnectServerHandler.HandleRequestAsync() at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at SaasKit.Multitenancy.Internal.TenantResolutionMiddleware1.Invoke(HttpContext context, ITenantResolver1 tenantResolver) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Builder.Extensions.UsePathBaseMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)

Steps to reproduce

Use FirstOrDefaultAsync, AnyAsync, ToListAsync from namespace Microsoft.EntityFrameworkCore

Further technical details

EF Core version: 3.0.0 and 3.1.0
Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Target framework: (e.g. .NET Core 3.0)
Operating system: Windows 10
IDE: (e.g. Visual Studio 2019 16.3.4)

closed-question customer-reported

All 8 comments

Share your csproj. Most likely mismatched package versions causing issue.

Share your csproj. Most likely mismatched package versions causing issue.

this is csproj from project DOMAIN:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="9.0.0" />
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
    <PackageReference Include="GateCode.Core.Framework.v2" Version="3.0.0" />
  </ItemGroup>

</Project>

this csproj from project DATA:


<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="Migrations\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.1" />
    <PackageReference Include="System.Data.SqlClient" Version="4.7.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\Domain\Healther.Domain.csproj" />
  </ItemGroup>

</Project>

this csproj from my framework:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <Authors>GateCode</Authors>
    <Company>GateCode Solutions</Company>
    <Product>Framework ASP.NET Core</Product>
    <Description>Framework desenvolvido pela GateCode para padr玫es de projeto .NET da GATECODE SOLUTION</Description>
    <Copyright />
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <Version>3.0.0</Version>
    <PackageIconUrl>http://gatecode.com.br/assets/images/gatecode.png</PackageIconUrl>
    <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
    <PackageId>GateCode.Core.Framework.v2</PackageId>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="9.0.0" />
    <PackageReference Include="FluentValidation" Version="8.5.0" />
    <PackageReference Include="LinqKit.Microsoft.EntityFrameworkCore" Version="1.1.16" />
    <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="3.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
    <PackageReference Include="System.Net.Http" Version="4.3.4" />
  </ItemGroup>

</Project>
  • AutoMapper.Extensions.Microsoft.DependencyInjection depends on DI 2.0.0
  • LinqKit.Microsoft.EntityFrameworkCore depends on EFCore 2.0.1
  • Microsoft.AspNetCore.Http depends on ASP.NET Core 2.2 packages

You need to use same major.minor packages for EFCore & Asp.NET Core packages else you will run into issues with wrong assembly versions.
In your case, LinqKit is using EF Core 2.0.1 which depended on System.Interactive.Async but EF Core 3.0 does not so you hit the error. Before moving to .NET Core 3.0 you need to make sure that all the dependencies you are using also moved to .NET Core 3.0

  • AutoMapper.Extensions.Microsoft.DependencyInjection depends on DI 2.0.0
  • LinqKit.Microsoft.EntityFrameworkCore depends on EFCore 2.0.1
  • Microsoft.AspNetCore.Http depends on ASP.NET Core 2.2 packages

You need to use same major.minor packages for EFCore & Asp.NET Core packages else you will run into issues with wrong assembly versions.
In your case, LinqKit is using EF Core 2.0.1 which depended on System.Interactive.Async but EF Core 3.0 does not so you hit the error. Before moving to .NET Core 3.0 you need to make sure that all the dependencies you are using also moved to .NET Core 3.0

thank you so much

See https://github.com/scottksmith95/LINQKit/issues/100 for a preview of LinqKit.Microsoft.EntityFrameworkCore that should work with EF Core 3

Thank you @MonkeyBrush, i was waiting this update.

thank you again

@pauloasantos, I'm running into this as well. My Web API app targets netcoreapp3.0 and my services project which handles data access is netstandard2.1.

I'm getting

System.IO.FileNotFoundException: Could not load file or assembly 'System.Interactive.Async, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'. The system cannot find the file specified.

...when using LinqKit's AsExpandable() on a DbSet.

What exactly did you do to resolve your issue?

Ahhh..never mind. I see. There's a preview package.

Was this page helpful?
0 / 5 - 0 ratings