OData / WebApi

OData Web API: A server library built upon ODataLib and WebApi
https://docs.microsoft.com/odata
Other
857 stars 473 forks source link

Error creating container on route constraint matching #1093

Open kedrzu opened 7 years ago

kedrzu commented 7 years ago

When using OData along with NLog.Web there is an error thrown when matching route constraints, on creating a request container. Error says, that request container is already created. It seems that NLog is getting route data multiple times, and Match method cannot be called that way.

Assemblies affected

System.Web.OData 6.1

Reproduce steps

Use NLog.Web along logging along with OData. My case was logging a warning inside OAuth auth handler.

Error is thrown in this specific place of code: https://github.com/OData/WebApi/blob/master/src/System.Web.OData/OData/Routing/ODataPathRouteConstraint.cs#L119

Expected result

I guess it should get already created container, and create one if not found.

Actual result

Throws error that request container is already created.

biaol-odata commented 7 years ago

@kedrzu : do you have any sample project code to share for repo? Thanks.