1. Scott Anderson
  2. ActionMailer.Net
  3. Issues
Issue #66 resolved

Stackoverflow exception in MailerBase 0.7.4

philip 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 = 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