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

Ocelot is not working with .NET Core 3 #1001

Closed
jsantanders opened this issue Aug 28, 2019 · 13 comments · Fixed by #1025
Closed

Ocelot is not working with .NET Core 3 #1001

jsantanders opened this issue Aug 28, 2019 · 13 comments · Fixed by #1025

Comments

@jsantanders
Copy link

Expected Behavior

the following method extension

public static IOcelotBuilder AddOcelot(this IServiceCollection services);
public static IOcelotBuilder AddOcelot(this IServiceCollection services, IConfiguration configuration);

add the Ocelot Gateway to the AspNetCore project.

Actual Behavior

throws an exception

System.TypeLoadException
  HResult=0x80131522
  Message=Could not load type 'Microsoft.Extensions.DependencyInjection.MvcJsonMvcCoreBuilderExtensions' from assembly 'Microsoft.AspNetCore.Mvc.Formatters.Json, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
  Source=Ocelot
  StackTrace:
   at Ocelot.DependencyInjection.OcelotBuilder..ctor(IServiceCollection services, IConfiguration configurationRoot)
   at Ocelot.DependencyInjection.ServiceCollectionExtensions.AddOcelot(IServiceCollection services, IConfiguration configuration)
   at OcelotApiGw.Startup.ConfigureServices(IServiceCollection services) in <path to source code file> line 73
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
   at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass15_0.<BuildStartupServicesFilterPipeline>g__RunPipeline|0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass14_0.<ConfigureServices>g__ConfigureServicesWithContainerConfiguration|0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)

possible related to this

Steps to Reproduce the Problem

  1. Try to add ocelot with the method extension.

Specifications

  • Version: 13.5.2
  • Platform: Windows, .NET Core SDK 3.0 preview8
@rynowak
Copy link

rynowak commented Aug 28, 2019

ASP.NET Core team here - this was API was moved to another assembly as part of removing Newtonsoft.Json from the core of the platform.

If you want to keep using this you still can by referencing https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.NewtonsoftJson/3.0.0-preview8.19405.7 but you'll have to cross compile. Please ping me or @pranavkm if you need help with migration to 3.0

@dennismdejong
Copy link

This is still an issue, just tried the following combination:

  • Ocelot 13.8.0-alpha0016
  • Microsoft.AspNetCore.Mvc.NewtonsoftJson 3.0.0-preview9.19424.4
  • Microsoft.NETCore.App 3.0.0-preview7-27912-14

@jsantanders
Copy link
Author

Just following the instructions that @rynowak mention, is straightforward run the project with net core 3. I suppose the Ocelot team want to use the new Json native library, but if it help I can do a PR with the project using the Newtonsoft library.

@hikalkan
Copy link

Hi all. Any plan to move asp.net core 3.0 without @rynowak's temporary solution..?

@geffzhang
Copy link
Contributor

@hikalkan https://github.com/geffzhang/Ocelot/tree/netcore3.0 I'm working on upgrading .net core 3.0 and there are still several unit tests that haven't passed

@hikalkan
Copy link

Thank you @geffzhang for informing me and the community :)

@yzinc
Copy link

yzinc commented Sep 28, 2019

Hi all! Do you know when upgrade to .net core 3.0 will be ready? I think not only I wait for this really important update

@Zero-Xiong
Copy link

same issue faced. waiting for the final solution

@mehranzand
Copy link

I have same issue! is anybody knows .net core 3 version update when will be ready?

@vip32
Copy link

vip32 commented Oct 7, 2019

yes issue also appears in final 3.0.100

vip32 added a commit to vip32/Naos.Sample that referenced this issue Oct 7, 2019
@hikalkan
Copy link

hikalkan commented Oct 8, 2019

I have a talk on a Microservice solution in ~2 weeks and the solution is using Ocelot with ASP.NET Core 3.0 (https://net.developerdays.pl/microservice-implementation-tools-patterns-practices/).

I don't want to rollback to .net core 2.2 😄

Any estimation about the first .net core 3.0 compatible release?
I know this is an open source project. Just kindly asking. Thanks.

@martincostello
Copy link

Try tracking #1025 for updates.

@fawdlstty
Copy link

Is this the problem of dotnetcore3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.