I currently have what I think is the problem with streams with action filters. In my application, I use ActionFilter to trace each action, this trace will provide statistical information such as call duration, and also record the parameters sent to the action.
The actual trace implementation (which was executed by another command) works with the IDisposable object, basically, when the instance is created, the start time is initialized, and when the object is deleted, it sets the end date, both calls create an entry in the custom log, the code below (delete some code for simplicity):
public class TraceActionAttribute : ActionFilterAttribute { private IDisposable logManagerBeginTrace;
The exception doesnβt tell me much, basically that he is trying to dispose of the elements while the others are still active, I still need to examine the code of the tracer ... but I found this post which says the following:
In previous versions of ASP.NET MVC, action filters were created for each request, except in a few cases. Such behavior was never guaranteed behavior, but merely a detailed implementation, and the filter contract was to consider them stateless. In ASP.NET MVC 3, filters are cached more aggressively. Therefore, any custom action filters that incorrectly maintain the state of an instance can be corrupted.
Which looks very strange to me, since the action filters should be equal, so we post public properties on it and configure its behavior for certain actions, right?
I appreciate any help with this, Regards.