ASP MVC: When is IController Dispose() called?

Dispose is called after the view is rendered, always.

The view is rendered in the call to ActionResult.ExecuteResult. That’s called (indirectly) by ControllerActionInvoker.InvokeAction, which is in turn called by ControllerBase.ExecuteCore.

Since the controller is in the call stack when the view is rendered, it cannot be disposed then.

Leave a Comment