Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

When replacing Controller.Dispose with an explicit implementation the base Dispose is an action #5352

Closed
rynowak opened this issue Oct 3, 2016 · 2 comments
Assignees
Milestone

Comments

@rynowak
Copy link
Member

rynowak commented Oct 3, 2016

public class HomeController : Controller, IDisposable
{
        void IDisposable.Dispose()
        {
            Debug.WriteLine("Got disposed");
        }
}

If you define this controller, then /Home/Dispose will be routed to the Controller.Dispose() method and will call it as an action.

Note that this requires you to reimplement IDisposable on the subclass. Just overriding the protected void Dispose() would not have any deleterious impact.

This is a similar case that also reproduces the bug:

public class HomeController : Controller
{
        public new void Dispose()
        {
            Debug.WriteLine("Got disposed");
        }
}
@khellang
Copy link
Contributor

khellang commented Oct 4, 2016

Shouldn't this cover that last case? DerivedController (which is being tested) has this;

@rynowak
Copy link
Member Author

rynowak commented Oct 4, 2016

That covers the negative case. DerivedController.Dispose() should be considered an action since DerivedController doesn't declare IDisposable

@danroth27 danroth27 added this to the 1.1.0 milestone Oct 5, 2016
kichalla added a commit that referenced this issue Nov 2, 2016
kichalla added a commit that referenced this issue Nov 2, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants