Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: Web Api 2-OData same variable name causes type error [1128]

$
0
0
I have an odata url that is using the same variable name in two separate any clauses which causes the api to think to that the second variable (i.e. Address entity) is of the same name is of the same type as the first variable (i.e. User) and causes an error for a column not existing. I am using the web api version 2 July 8th build.

http://localhost:2351/ServtracWebPortals/Mexico/amtechcs/servtracweb/dataservice/InvoiceLines?$filter=((Invoice/Customer/Users/any(n:%20(n/Id%20eq%20guid'4d8e5653-754b-e211-b94e-001b21ce410d')))%20and%20(PurchaseOrderLine/PurchaseOrder/Addresses/any(n:%20((n/AddressType%20eq%20'EndUser')%20or%20(n/AddressType%20eq%20'FreightForwarder')))))


{
"odata.error":{
"code":"","message":{
"lang":"en-US","value":"An error has occurred."
},"innererror":{
"message":"Instance property 'AddressType' is not defined for type 'Amtech.Servtrac.Server.Entities.Security.User'","type":"System.ArgumentException","stacktrace":" at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Tracing.Tracers.HttpControllerTracer.<ExecuteAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__21`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()"
}
}
}
Comments: This appears to be a bug in the Web API OData query processing. For now as a workaround we recommend using different variable names in each part of the query.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>