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

EF Core 3.0 - Could not load file System.Interactive.Async #18398

Closed
pauloasantos opened this issue Oct 16, 2019 · 8 comments
Closed

EF Core 3.0 - Could not load file System.Interactive.Async #18398

pauloasantos opened this issue Oct 16, 2019 · 8 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@pauloasantos
Copy link

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.AsExpandable[T](IQueryable1 query, Func2 queryOptimizer)
at LinqKit.Extensions.AsExpandable[T](IQueryable1 query) at GateCode.Core.Framework.Infra.Data.Repositories.Repository1.b__4_0()
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj) at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location where exception was thrown --- at Healther.Infra.Data.Repositories.UsuarioRepository.BuscarPeloLoginAsync(String login) in C:\tdsasistemas\projetos\healther\backend\src\Healther\Modules\Infra\Data\Repositories\UsuarioRepository.cs:line 58 at Healther.Domain.Commands.Usuario.Handler.UsuarioCommandHandler.RealizaLoginAsync(Nullable1 idUsuario, String login, String senha) 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)

@smitpatel
Copy link
Contributor

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

@pauloasantos
Copy link
Author

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>

@smitpatel
Copy link
Contributor

  • 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

@smitpatel smitpatel added closed-no-further-action The issue is closed and no further action is planned. and removed type-bug labels Oct 16, 2019
@pauloasantos
Copy link
Author

  • 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

@MonkeyBrush
Copy link

See scottksmith95/LINQKit#100 for a preview of LinqKit.Microsoft.EntityFrameworkCore that should work with EF Core 3

@pauloasantos
Copy link
Author

Thank you @MonkeyBrush, i was waiting this update.

thank you again

@jsauve
Copy link

jsauve commented Nov 17, 2019

@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?

@jsauve
Copy link

jsauve commented Nov 17, 2019

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

@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
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

5 participants