Closed tombohub closed 2 years ago
I'm seeing similar - some entities work, some fail with an error similar to above.
Expression of type 'System.Nullable`1[System.Decimal]' cannot be used for return type 'System.Object'
Expression of type 'System.Nullable`1[System.DateTime]' cannot be used for return type 'System.Object'
Expression of type 'System.Nullable`1[System.Int32]' cannot be used for return type 'System.Object'
Expression of type 'System.DateTime' cannot be used for return type 'System.Object'
As best I can tell, line 28 -99 in https://github.com/edandersen/core-admin/blob/master/src/DotNetEd.CoreAdmin/Views/CoreAdminData/Index.cshtml are the issue, but not quite following the code enough to do a PR.
Fixed in 2.6.0 :-)
I still have the same issue with 2.6.0 (on a blank new asp.net project, when going to the user model /CoreAdminData/Index/Users
)
What's the error on this new entity?
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Mathieu Poussin @.> Sent: Saturday, May 14, 2022 5:15:12 PM To: edandersen/core-admin @.> Cc: Ed Andersen @.>; State change @.> Subject: Re: [edandersen/core-admin] ArgumentException: Expression of type 'System.Decimal' cannot be used for return type 'System.Object' (Issue #66)
I still have the same issue with 2.6.0 (on a blank new asp.net project, when going to the user model /CoreAdminData/Index/Users)
— Reply to this email directly, view it on GitHubhttps://github.com/edandersen/core-admin/issues/66#issuecomment-1126762663, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HHBGCM4JRJHDIPHTETVJ7GRBANCNFSM5U2OTQWA. You are receiving this because you modified the open/close state.Message ID: @.***>
System.ArgumentException: Expression of type 'System.Nullable`1[System.DateTimeOffset]' cannot be used for return type 'System.Object'
at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection`1 parameters, String paramName)
at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerable`1 parameters)
at AspNetCoreGeneratedDocument.Views_CoreAdminData_Index.<>c__DisplayClass0_0.<ExecuteAsync>b__0(IGridColumnsOf`1 columns)
at NonFactors.Mvc.Grid.HtmlGridExtensions.Build[T](IHtmlGrid`1 html, Action`1 builder)
at AspNetCoreGeneratedDocument.Views_CoreAdminData_Index.ExecuteAsync()
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Indeed sorry it's not exactly the same error but quite similar
Looks like datetime offset needs support too. Will get on it. Thanks.
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: Mathieu Poussin @.> Sent: Saturday, May 14, 2022 5:38:07 PM To: edandersen/core-admin @.> Cc: Ed Andersen @.>; State change @.> Subject: Re: [edandersen/core-admin] ArgumentException: Expression of type 'System.Decimal' cannot be used for return type 'System.Object' (Issue #66)
System.ArgumentException: Expression of type 'System.Nullable1[System.DateTimeOffset]' cannot be used for return type 'System.Object' at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection
1 parameters, String paramName)
at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerable1 parameters) at AspNetCoreGeneratedDocument.Views_CoreAdminData_Index.<>c__DisplayClass0_0.<ExecuteAsync>b__0(IGridColumnsOf
1 columns)
at NonFactors.Mvc.Grid.HtmlGridExtensions.Build[T](IHtmlGrid1 html, Action
1 builder)
at AspNetCoreGeneratedDocument.Views_CoreAdminData_Index.ExecuteAsync()
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable1 statusCode) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable
1 statusCode)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.
— Reply to this email directly, view it on GitHubhttps://github.com/edandersen/core-admin/issues/66#issuecomment-1126772475, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEF6HD3743NMDRQA3XY3JDVJ7JG7ANCNFSM5U2OTQWA. You are receiving this because you modified the open/close state.Message ID: @.***>
Should I open a new issue for that ?
No, I will pick it up, reopened.
Okay DateTimeOffset should be supported in 2.6.1. Thanks!
There were still some types missing for my db- nullables and int64. I created a pull request with them: https://github.com/edandersen/core-admin/pull/69
I have followed installation for .NET 6.
this is the model I have:
and when trying to view this model in coreadmin there's an error:
ArgumentException: Expression of type 'System.Decimal' cannot be used for return type 'System.Object'
Full stack trace:
Thank you