Stackoverflow exception in MailerBase 0.7.4

philip ross avatarphilip ross created an issue

There is a flaw in the dispose method on MailerBase in ActionMailer 0.7.4 that causes a stackoverflow exception in an MVC 4 project.

When running with a IOC/dependency provider, such as MEF, that disposes of the request scope the fault in MailerBase causes a stackoverflow. The derived class should call base.Dispose(disposing) not base.Dispose(). E.G. the following version fixes the problem:

protected override void Dispose( bool disposing )
    {
      if ( disposing )
      {
        if ( MailSender != null )
        {
          MailSender.Dispose();
          MailSender = null;
        }
      }
      base.Dispose( disposing );
    }

cheers, -- Philip

Comments (4)

  1. James Newell

    Is there any chance to get a 0.7.5 release with this change published out for nuget before the 0.8 release? I am hitting this exact issue in a project and I can clearly see that the resolution above will fix it, but the only available version in nuget right now is 0.7.4 which uses the previous code causing the overflow.

    As a temporary workaround I am able to subclass MailerBase and override Dispose(disposing) to not call base.Dispose(disposing), but an actual release is preferable.

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.