Open
Description
Issue
In out product we are using the method Microsoft.AspNet.OData.Extensions.HttpConfigurationExtensions.MapODataServiceRoute(this HttpConfiguration configuration, string routeName, string routePrefix, Action configureAction) to map our OData service routes.
We have some static routes and some dynamic ones. For the dynamic ones, we need to be able to "unmap" a route which was previously added. My question is how can I do that unmapping in a clean way without having any memory leak.
Assemblies affected
Microsoft.AspNet.OData.dll v7.5.12
Reproduce steps
- Check entries of HttpConfiguration.Routes and HttpConfiguration.Properties
- Map a odata route using Microsoft.AspNet.OData.Extensions.HttpConfigurationExtensions.MapODataServiceRoute(this HttpConfiguration configuration, string routeName, string routePrefix, Action configureAction)
- Check entries of HttpConfiguration.Routes and HttpConfiguration.Properties -> should have some added entries
- Unmap the OData route. Not sure what is the best way to do. Currently we just do HttpConfiguration.Routes.Remove(routName) but that does not unmap everything so some references are still there, e.g. to the created ODataRootContainer.
- Check entries of HttpConfiguration.Routes and HttpConfiguration.Properties -> should have some entries like in 1., i.e. no memory leak
Expected result
When a route is mapped and unmapped, there should not be a increase in memory.
Actual result
When there is no way to unmap a route completley, there is a memory leak.