voronov-maxim / OdataToEntity

OData .net core
MIT License
153 stars 32 forks source link

Support ASP.NET Core 2.1 #21

Closed techniq closed 6 years ago

techniq commented 6 years ago

Finally found a little bit of time to evaluate ODataToEntity for our projects again (with OData/WebApi still lagging behind) and getting the following stack trace while attempting to access a simple Get

[HttpGet]
public ODataResult<Department> Get()
{
    var asyncEnumerator = GetAsyncEnumerator(HttpContext, HttpContext.Response.Body);
    return OData<Department>(asyncEnumerator);
}
System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameRequestHeaders' from assembly 'Microsoft.AspNetCore.Server.Kestrel.Core, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
   at OdataToEntity.AspNetCore.OeControllerBase.GetAsyncEnumerator(HttpContext httpContext, Stream responseStream, Boolean navigationNextLink, Nullable`1 maxPageSize)
   at Finance.Web.Controllers.Organizations.DepartmentsController.Get() in /Users/techniq/Documents/Development/sbcs-chh/app-finance/Finance.Web/Controllers/Organizations/DepartmentsController.cs:line 38
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware:Error: An unhandled exception has occurred while executing the request.

I'm using ASP.NET Core / EFCore version 2.1.1 so not sure if there is a compatibility issue with it.

image

I was also getting the error reported in https://github.com/voronov-maxim/OdataToEntity/issues/16 again on startup but I've simplified my DbContext and will slowly add back classes until I can identity the root cause and submit a simplified case.

Lastly, could you push an updated NuGet package that includes the fix for composite keys (it can be done after we figure this issue out). Thanks!

techniq commented 6 years ago

It does appear Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.FrameRequestHeaders was removed in aspnetcore 2.1