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

Edited Issue: [GlobalErrorHandling]Unhandled exception at route matching (WebHost) is turned into a yellow screen instead of Internal server error [1355]

$
0
0
_Repro_:

_Create a new constraint_:
```
public class ExceptionThrowingRoutingConstraint : IHttpRouteConstraint
{
public bool Match(HttpRequestMessage request, IHttpRoute route, string parameterName, IDictionary<string, object> values, HttpRouteDirection routeDirection)
{
throw new InvalidOperationException("Som exception at route matching");

return false;
}
}
```

_Register the above constraint_:
```
DefaultInlineConstraintResolver resolver = new DefaultInlineConstraintResolver();
resolver.ConstraintMap.Add("err", typeof(ExceptionThrowingRoutingConstraint));
config.MapHttpAttributeRoutes(resolver);
```

Create an action like following:
```
[Route("api/values/routeconstraint/{id:err}")]
public void GetCustomRoutingConstraint(string id)
{
}
```

_Expected_:
500 Internal Server Error

_Actual_:
Unhandled exception with yellow screen

__Note__: I also noticed that if i register an custom exception handler which doesn't modify the 'Result', I am seeing a 500 Internal Server. Since i haven't modified the 'Result' property, i would have expected it to be still unhandled exception.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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