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

.NET Core 3.0 support? #1748

Open
enchev opened this issue Jan 30, 2019 · 234 comments
Open

.NET Core 3.0 support? #1748

enchev opened this issue Jan 30, 2019 · 234 comments

Comments

@enchev
Copy link

@enchev enchev commented Jan 30, 2019

It seems that latest official OData (Microsoft.AspNetCore.OData 7.1.0) cannot be used in .NET Core 3.0.0 Preview 2 MVC app:

Startup.cs

    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(options =>
            {
                options.EnableEndpointRouting = false;
            }).SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0);

            services.AddOData();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc(builder =>
            {
                //
            });
        }
    }

Exception:

System.TypeLoadException: 'Could not load type 'Microsoft.AspNetCore.Mvc.Internal.ActionConstraintCache' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.'

image

Let me know if I've missed some setting!

@JohnGalt1717

This comment has been minimized.

Copy link

@JohnGalt1717 JohnGalt1717 commented Feb 6, 2019

+1

@thomas-rose

This comment has been minimized.

Copy link

@thomas-rose thomas-rose commented Mar 7, 2019

+1

@JohnGalt1717

This comment has been minimized.

Copy link

@JohnGalt1717 JohnGalt1717 commented Mar 7, 2019

Still broken in Preview 3.

@madansr7

This comment has been minimized.

Copy link
Contributor

@madansr7 madansr7 commented Mar 7, 2019

@enchev , thanks for bringing this to our attention.
The team needs time to investigate the error. The current version of the library is built against Core 2.0 and we need to spend sometime to evaluate any breaking changes in 3.0 that would require a change in the behavior of OData libraries.

@JohnGalt1717

This comment has been minimized.

Copy link

@JohnGalt1717 JohnGalt1717 commented Mar 7, 2019

@madansr7 Mostly this has to do with routing because of the new method of UseRouting(). In the case of SignalR they updated their registration to work under the UseRouting(options => {}) instead of as a direct extension on the app.XXX.

@madansr7

This comment has been minimized.

Copy link
Contributor

@madansr7 madansr7 commented Mar 8, 2019

@JohnGalt1717, thanks for the info. This definitely helps!
We will put this up on our board for grabs.

@Rymix

This comment has been minimized.

Copy link

@Rymix Rymix commented Apr 3, 2019

Hi, no update about this issue ?

@sergiosysmiddle

This comment has been minimized.

Copy link

@sergiosysmiddle sergiosysmiddle commented Apr 9, 2019

@JohnGalt1717, thanks for the info. This definitely helps!
We will put this up on our board for grabs.

Hello @madansr7 , any news?

@charlesjelliott

This comment has been minimized.

Copy link

@charlesjelliott charlesjelliott commented Apr 16, 2019

+1 Also a problem for me

@Hantse

This comment has been minimized.

Copy link

@Hantse Hantse commented Apr 22, 2019

For me too :)

@ace90210

This comment has been minimized.

Copy link

@ace90210 ace90210 commented Apr 22, 2019

+1

@madansr7

This comment has been minimized.

Copy link
Contributor

@madansr7 madansr7 commented May 1, 2019

@JohnGalt1717, sorry for the delayed response. The team has this on the board now and we are investigating updates that need to be made.

@BlasVilla

This comment has been minimized.

Copy link

@BlasVilla BlasVilla commented May 8, 2019

+1

@CLFPosthumus

This comment has been minimized.

Copy link

@CLFPosthumus CLFPosthumus commented May 9, 2019

Issue remains with preview 4,
+1

@wakkasha

This comment has been minimized.

Copy link

@wakkasha wakkasha commented May 9, 2019

+1

4 similar comments
@aviezzi

This comment has been minimized.

Copy link

@aviezzi aviezzi commented May 10, 2019

+1

@ycrespo

This comment has been minimized.

Copy link

@ycrespo ycrespo commented May 10, 2019

+1

@cesfnc

This comment has been minimized.

Copy link

@cesfnc cesfnc commented May 10, 2019

+1

@artemedea

This comment has been minimized.

Copy link

@artemedea artemedea commented May 10, 2019

+1

@LisaTehChatBot

This comment has been minimized.

Copy link

@LisaTehChatBot LisaTehChatBot commented May 10, 2019

@JohnGalt1717, sorry for the delayed response. The team has this on the board now and we are investigating updates that need to be made.

They know, and I miss which part of "preview" isn't clear

@ace90210

This comment has been minimized.

Copy link

@ace90210 ace90210 commented May 10, 2019

@LisaTehChatBot it's called feedback, you know the point in releasing a preview

@robertmclaws

This comment has been minimized.

Copy link
Collaborator

@robertmclaws robertmclaws commented May 10, 2019

Let's keep this on topic please, folks. No need to be rude to each other.

@Hantse

This comment has been minimized.

Copy link

@Hantse Hantse commented May 10, 2019

Idk if that can help,

But i have similar issue in versionning and find the problems
microsoft/aspnet-api-versioning#499

The class ActionConstraintCache is now internal on last version of .NetCore 3.0

@xuzhg

This comment has been minimized.

Copy link
Member

@xuzhg xuzhg commented May 10, 2019

The problem is from the usage of ActionConstraintCache class in ODataActionSelector.
in .NET Core 3.0.0, the ActionConstraintCache class is not presented.

If I remove the
public ODataActionSelector( IActionDescriptorCollectionProvider actionDescriptorCollectionProvider, ActionConstraintCache actionConstraintProviders, ILoggerFactory loggerFactory)

It works for the .NET Core 3.0.0 Preview4 by using old Route-based pattern. However, I can't use the _innerSelector, so we have to find a solution to make sure the innerSelector works also.

Besides, we still need to investigate whether to move to endpoint-based routing or router-based routing, or both. If you have any suggestions, please feel free share with us.

@rasolo

This comment has been minimized.

Copy link

@rasolo rasolo commented May 15, 2019

I have no idea what is going on but what solved it for me was to remove ApiVersioning from my project.

So in startup.cs i removed:
services.AddApiVersioning(o => { o.AssumeDefaultVersionWhenUnspecified = true; o.DefaultApiVersion = new ApiVersion(1, 0); });

And removed the ApiVersion attribute from controllers.

I am using Web Api Core 3 preview 5, it worked in preview 3 for me.
I got the same error message as the OP.

@alberk8

This comment has been minimized.

Copy link

@alberk8 alberk8 commented May 19, 2019

The problem is from the usage of ActionConstraintCache class in ODataActionSelector.
in .NET Core 3.0.0, the ActionConstraintCache class is not presented.

If I remove the
public ODataActionSelector( IActionDescriptorCollectionProvider actionDescriptorCollectionProvider, ActionConstraintCache actionConstraintProviders, ILoggerFactory loggerFactory)

It works for the .NET Core 3.0.0 Preview4 by using old Route-based pattern. However, I can't use the _innerSelector, so we have to find a solution to make sure the innerSelector works also.

Besides, we still need to investigate whether to move to endpoint-based routing or router-based routing, or both. If you have any suggestions, please feel free share with us.

I prefer that both endpoint-based routing and router-based routing be supported going forward as not to break legacy dotnet core apps.

@NetTecture

This comment has been minimized.

Copy link

@NetTecture NetTecture commented May 19, 2019

At this point I do not care about legacy because the only way to use Odata sensibly in terms of efficient (ror better: correct) sql generation is moving to either efcore 3.0 or entity framework (in net 3.0 preview), given taht theere are a TON of scenarios in which efcore 2.2 is throwing out grossly defective SQL.

Is there any roadmap to actually give us poor abused end users a chance to PLAN this? And/or at least give us some preview or something? Right now this smells like abandoned code, looks like abandonec code and behaves like abandoned code. Which is why more and more post s here get snippy - frustrations building up.

@EquiAvia

This comment has been minimized.

Copy link

@EquiAvia EquiAvia commented Dec 13, 2019

@alvachien

This comment has been minimized.

Copy link

@alvachien alvachien commented Dec 13, 2019

@tjrobinson @GlennVegarSorensen
Maybe you can take a look at the example from @xuzhg local repository: https://github.com/xuzhg/WebApiSample/tree/master/AspNetCore3x/AspNetCoreOData3x

Simply replace the OData package to 7.3.0 Beta, the repository above can be built, run and test.

With TargetFramework as: netcoreapp3.0;
Package Microsoft.EntityFrameworkCore.InMemory, Version 3.1.0
Package Microsoft.EntityFrameworkCore.SqlServer, Version 3.1.0

@XardasLord

This comment has been minimized.

Copy link

@XardasLord XardasLord commented Dec 13, 2019

@mikepizzo For me it's ok to release 7.3 version supporting .NET Core 3.1

@keatkeat87

This comment has been minimized.

Copy link

@keatkeat87 keatkeat87 commented Dec 13, 2019

Just upgrade to 3.1 and odata 7.3 beta, look like ok, thank a lot for odata team effort.

@alvachien

This comment has been minimized.

Copy link

@alvachien alvachien commented Dec 13, 2019

@mikepizzo
Also support to release 7.3 version supporting .NET Core 3.1.
The only question is when ...

@tjrobinson

This comment has been minimized.

Copy link

@tjrobinson tjrobinson commented Dec 13, 2019

I'm getting this error when building:

[CS1705] Assembly 'Microsoft.AspNetCore.OData' with identity 'Microsoft.AspNetCore.OData, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'Microsoft.AspNetCore.Routing, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.AspNetCore.Routing' with identity 'Microsoft.AspNetCore.Routing, Version=2.2.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

TargetFramework: netcoreapp3.1

I resolved this by adding this to my .csproj file:

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>
@AgustinLuquesSV

This comment has been minimized.

Copy link

@AgustinLuquesSV AgustinLuquesSV commented Dec 13, 2019

@keatkeat87

Can we see your Startup.cs using net core 3.1 and odata 7.3?

@jayoungers

This comment has been minimized.

Copy link

@jayoungers jayoungers commented Dec 13, 2019

In our dotnet core 3.1 app, I've added the package:

<PackageReference Include="Microsoft.AspNetCore.OData" Version="7.3.0-beta" />

And made the adjustments to startup:

            services.AddControllers(mvc =>
            {
                mvc.EnableEndpointRouting = false;
            });

...

            //app.UseRouting();
            //app.UseEndpoints(endpoints =>
            //{
            //    endpoints.MapControllers();
            //});

            app.UseMvc(routeBuilder =>
            {
                routeBuilder.EnableDependencyInjection();
            });

My custom end points appear to be working:

        [HttpGet]
        public Task<List<MyViewModel>> Query([FromServices] MyService, ODataQueryOptions<MyEntity> queryOptions)

Thanks everyone!

@XardasLord

This comment has been minimized.

Copy link

@XardasLord XardasLord commented Dec 16, 2019

I'm using this package the same way as @jayoungers. My startup:

app.UseMvc(routeBuilder =>
{
    routeBuilder.EnableDependencyInjection();
				 
    routeBuilder.Select().Expand().Filter().OrderBy().MaxTop(odataOptions.MaxPageCount).Count()
        .EnableContinueOnErrorHeader();

    routeBuilder.MapODataServiceRoute("odata", "odata",
        oDataModelBuilder.GetEdmModel(app.ApplicationServices));
});

OData queries seem to be working :)

@Diraekt

This comment has been minimized.

Copy link

@Diraekt Diraekt commented Dec 16, 2019

Is there any chance to see the commit changes from nightly build 7.3 to the beta?

We have some features they worked with the nightly build but does not work with the beta release.

Thanks

@xuzhg

This comment has been minimized.

Copy link
Member

@xuzhg xuzhg commented Dec 16, 2019

@Diraekt

This comment has been minimized.

Copy link

@Diraekt Diraekt commented Dec 16, 2019

Thank you very much for your fast response.

There are no commit ids, tags and or branches for "nightly bulids"?
The only thing I found was the beta branch called "ASP.NET Core 3.x", but when I look at the commit history of this branch, I can't reproduce the changes from NightlyBuild to the BetaBuild.

Thanks for a comment ;)

@sdar1419sn

This comment has been minimized.

Copy link

@sdar1419sn sdar1419sn commented Dec 20, 2019

As discussed above, i upgraded to 3.1 with ODATA 7.3.0-beta . ODATA is partially working. i have seen $select and $expand is not working for me and getting error:[{"instance":null,"container":{},"modelID":"de19de66-6e70-4ce2-a1e8-317e003e02ea","untypedInstance":null,"instanceType":null,"useInstanceForProperties":false}]. other then that all queries are working(like filter,groupby, top etc). please do the needful

@hassanhabib

This comment has been minimized.

Copy link

@hassanhabib hassanhabib commented Dec 22, 2019

Here's a step by step for those who want to try the beta version themselves (source code included):
https://devblogs.microsoft.com/odata/experimenting-with-odata-in-asp-net-core-3-1/

Also a video tutorial:
https://www.youtube.com/watch?v=VGnLZ6Fxnx8

@sdar1419sn

This comment has been minimized.

Copy link

@sdar1419sn sdar1419sn commented Dec 22, 2019

Here's a step by step for those who want to try the beta version themselves (source code included):
https://devblogs.microsoft.com/odata/experimenting-with-odata-in-asp-net-core-3-1/

Also a video tutorial:
https://www.youtube.com/watch?v=VGnLZ6Fxnx8

thanks for your post. got to know , where lies the problem as ODATA is not friendly with mvc api routes.just used odata routes and everything is working as expacted and also removed routes.EnableDependencyInjection(); from routes delegate. just a concern , why is not working with existing mvc api routes?. once again thanks a lot!!

@hassanhabib

This comment has been minimized.

Copy link

@hassanhabib hassanhabib commented Dec 22, 2019

Here's a step by step for those who want to try the beta version themselves (source code included):
https://devblogs.microsoft.com/odata/experimenting-with-odata-in-asp-net-core-3-1/
Also a video tutorial:
https://www.youtube.com/watch?v=VGnLZ6Fxnx8

thanks for your post. got to know , where lies the problem as ODATA is not friendly with mvc api routes.just used odata routes and everything is working as expacted and also removed routes.EnableDependencyInjection(); from routes delegate. just a concern , why is not working with existing mvc api routes?. once again thanks a lot!!

The main reason is that this beta release doesn't support endpoints routing yet, but the final release should have that covered up.

@NetTecture

This comment has been minimized.

Copy link

@NetTecture NetTecture commented Dec 22, 2019

THen i have to wait with testing. For reasons of problems with odata and clients I happen to

  • use normal non odata routing for some endpoints - odata routing gets refused for some actions mostly.
  • use some normal non odata controllers to handle some non odata api endpoints. This is mostly a "no time to rewrite some clients, but I can just redirect them until we move them too data".

Together this means I pretty much MUST be able to use some routing other than odata ;( Once the new api is in place, i will open bug reports for every item under 1. Those acutally irk me.

@xuzhg

This comment has been minimized.

Copy link
Member

@xuzhg xuzhg commented Dec 24, 2019

@ALL


Today, we published the 7.3.0 RTM on nuget.org, see below:

image


Be noted:

  1. 7.3.0 RTM includes the .NET Core App 3.1 bits, see below.
  2. Please refer to https://docs.microsoft.com/en-us/aspnet/core/migration/30-to-31?view=aspnetcore-3.1&tabs=visual-studio for the prerequisites

Please help try it and feel free let us know any concerns and questions.

image

@xuzhg

This comment has been minimized.

Copy link
Member

@xuzhg xuzhg commented Dec 24, 2019

@hassanhabib Thanks for your blogs and videos. For the Endpoint routing, It's not included in 7.3.0 RTM, i think @mikepizzo 's previous comments illustrated the root cause. However, endpoint routing is high priority of our next step. We will work closely with .NET team to figure out the solution.

@hassanhabib

This comment has been minimized.

Copy link

@hassanhabib hassanhabib commented Dec 25, 2019

Thanks @xuzhg - I have updated the blog accordingly.

@jpmckearin

This comment has been minimized.

Copy link

@jpmckearin jpmckearin commented Jan 3, 2020

Thanks @xuzhg - I have updated the blog accordingly.

Link to the blog?

@xuzhg

This comment has been minimized.

Copy link
Member

@xuzhg xuzhg commented Jan 3, 2020

@jpmckearin here's the link for the new odata blog: https://devblogs.microsoft.com/odata

@TheAifam5

This comment has been minimized.

Copy link

@TheAifam5 TheAifam5 commented Jan 13, 2020

Recently released dotnet core 3.1 and odata 7.3.0 is no worth to upgrade. There is so much bugs, that breaks completely everything. :) so be aware.

@hidegh

This comment has been minimized.

Copy link

@hidegh hidegh commented Jan 13, 2020

@NetTecture

This comment has been minimized.

Copy link

@NetTecture NetTecture commented Jan 13, 2020

So, in simple words: The best thing about dotnetcore 3.1 is that you can throw out the buggy efcore and go back to proper entity framework which may be a LOT less modern - but actually WORKS?

@hidegh

This comment has been minimized.

Copy link

@hidegh hidegh commented Jan 13, 2020

@mikepizzo

This comment has been minimized.

Copy link
Member

@mikepizzo mikepizzo commented Jan 13, 2020

@TheAifam5 -- can you elaborate on your comment that there are a lot of bugs in updating to .NET Core 3.1 and odata 7.3.0?

OData 7.3.0 was targeted primarily at .NET Core 3.x support (especially since .NET Core 2.2 went out of support December 23rd), so we didn't do a lot of new feature work. However, looking through the issue list I don't see any newly reported OData issues that appear to be introduced in the new release. If you are encountering new issues, please create separate issues to report.

Note that there are some differences in what EF supports in .NET Core 3 and previous versions. If those what you are referring to, then please follow up in that forum. In the meantime, note the EF team is continuing to support the older EF, and we have tested the new OData 7.3.0 libraries with the older versions of EF to make sure that your existing code should continue to work against the older versions of EF.

@royzhang666

This comment has been minimized.

Copy link

@royzhang666 royzhang666 commented Jan 14, 2020

If you only want to make data queries, the QDataLite.Net may satisfy your requirements. It is sooo lightweight that will not take much effort on adoption. And it is based on netstandard2.1 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
OData WebApi
  
To do
You can’t perform that action at this time.