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

Created Issue: Exceptions raised from IQueryable implementation are always propagated as HTTP 500 [442]

$
0
0
I have constructed a Web API controller with an IQueryable action method as follows.

public class ValuesController : ApiController
{
[Queryable]
IQueryable<int> GetValues()
{
Task<int>[] tasks =
{
Task.Factory.StartNew<int>(() =>
{
throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
})
};

return tasks.Select(t => t.Result).AsQueryable();
}
}

Note that the GetValues() method is designed to raise an HttpResponseException when the Queryable action filter is run. It does not matter that the query values are computed asynchronously; I have also reproduced this by returning an IQueryable<int> implementation that raises the same exception for each property/method on the interface.

When this query is evaluated, a new exception with status code 500 (internal server error) is raised. Since I am explicitly raising and HttpResponseException via my query evaluation, I am expecting that the framework propagate my exception instead.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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