None of the constructors found with 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper' on type

Topics: General, Writing modules
Jan 22, 2014 at 10:27 AM
Hi guys,
I'm experiencing the above run time error message (truncated) while referencing a module2 from a module1, like on the following stackoverflow situation...

I've checked that module1 has a dependency on module2 even on its Module.txt file.
I've checked that the service interface implements Orchard's IDependency
I've checked that the modules are compiled correctly.

I have no idea of which could be the problem, please help.

Many Thanks.

Module1 is the NGM.Forum module, to which I'm applying some little changes.
In particular I've modified a controller's constructor to include an interface from
the above Module2. Everything builds fine.
Jan 24, 2014 at 3:50 PM
Sounds like you have done everything correctly. If you can post some code, we can probably help you figure it out.


Jan 24, 2014 at 4:53 PM
Ok. here is my code.
The "Module1" referencing the "Module2"
The added interface parameter is IEmailerService emailer.
    public class ThreadController : Controller, IUpdateModel {
        private readonly IOrchardServices _orchardServices;
        private readonly IForumService _forumService;
        private readonly IThreadService _threadService;
        private readonly IPostService _postService;
        private readonly ISiteService _siteService;
        private readonly IAuthorizationService _authorizationService;
        private readonly IAuthenticationService _authenticationService;
        private readonly IClock _clock;
        private readonly IEmailerService _emailer;

        public ThreadController(IOrchardServices orchardServices,
            IForumService forumService,
            IThreadService threadService,
            IPostService postService,
            ISiteService siteService,
            IShapeFactory shapeFactory,
            IAuthorizationService authorizationService,
            IAuthenticationService authenticationService,
            IClock clock, 
            IEmailerService emailer) {
            _orchardServices = orchardServices;
            _forumService = forumService;
            _threadService = threadService;
            _postService = postService;
            _siteService = siteService;
            _authorizationService = authorizationService;
            _authenticationService = authenticationService;
            _clock = clock;
            _emailer = emailer;

            T = NullLocalizer.Instance;
            Shape = shapeFactory;
In Module.txt I've added the dependecy as well as in the project references
Name: Forums
AntiForgery: enabled
Author: Nicholas Mayne
Version: 1.0.1
OrchardVersion: 1.7.0
Description: The Orchard Forums module introduces the ability to create a highly extensible set of Forums.
        Name: Forums
        Category: Content
        Description: Introduces a forum module allowing users to create forums, threads and posts.
    Dependencies: Module2.Emailer
And finally the code from my Module2
public interface IEmailerService : Orchard.IDependency
        void EmailThreadRelatedNotificaion(ebNotificationType t, string threadTitle, System.Collections.Generic.List<string> ccList);
        Orchard.Logging.ILogger Logger { get; set; }
        Orchard.Localization.Localizer T { get; set; }
Implementing Class
    public class EmailerService : IEmailerService
        private readonly IOrchardServices _orchardServices;
        private readonly INotifier _notifier;
        private readonly IRepository<SentNotificationRecord> _sentNotificationEmailRepository;

        public ILogger Logger { get; set; }
        public Localizer T { get; set; }

        public EmailerService(IOrchardServices orchardServices, INotifier notifier, IRepository<SentNotificationRecord> sentNotificationEmailRepository)
            _notifier = notifier;
            _orchardServices = orchardServices;
            _sentNotificationEmailRepository = sentNotificationEmailRepository;
            Logger = NullLogger.Instance;

        private SmtpClient BuildSmtpClient(SmtpSettingsPart smtpSettings)
            var mailClient = new SmtpClient
                Host = smtpSettings.Host,
                Port = smtpSettings.Port,
                EnableSsl = smtpSettings.EnableSsl,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = !smtpSettings.RequireCredentials
            if (!mailClient.UseDefaultCredentials && !String.IsNullOrWhiteSpace(smtpSettings.UserName))
                mailClient.Credentials = new NetworkCredential(smtpSettings.UserName, smtpSettings.Password);
            return mailClient;

        private void EmailSettingsLookup2(ebNotificationType t, String threadTitle, SentNotificationRecord pars )
            string keypart;

            switch (t)
                case ebNotificationType.OpenTicket:
                    keypart = "Notification.Ticket.Open";
                case ebNotificationType.ClosedTicket:
                    keypart = "Notification.Ticket.Close";
                case ebNotificationType.ThreadResult:
                    keypart = "Notification.Ticket.Close.Result";

                    keypart = String.Empty;
                    break; //should trigger an error...


            System.Configuration.AppSettingsReader reader = new System.Configuration.AppSettingsReader();

            pars.FromRecipient = reader.GetValue(keypart + ".From", typeof(string)).ToString();
            pars.ReplyToRecipient = reader.GetValue(keypart + ".ReplyTo", typeof(string)).ToString();
            pars.Subject = String.Format(reader.GetValue(keypart + ".Subject", typeof(string)).ToString(), threadTitle);
            pars.MailText = reader.GetValue(keypart + ".Body", typeof(string)).ToString();
            pars.ToBCCRecipients = reader.GetValue(keypart + ".ToBCC", typeof(string)).ToString();
            //TOCC was already set up by the caller


        /// <summary>
        /// </summary>
        /// <param name="t"></param>
        /// <param name="threadTitle"></param>
        /// <param name="ccList">list of destination recipients. must come from the caller as it's based on threads followers</param>
        public void EmailThreadRelatedNotificaion(ebNotificationType t, string threadTitle, List<string> ccList)
            var smtpSettings = _orchardServices.WorkContext.CurrentSite.As<SmtpSettingsPart>();
            if (smtpSettings != null && smtpSettings.IsValid())
                var mailClient = BuildSmtpClient(smtpSettings);
                bool WasRecorded = false;

                SentNotificationRecord newMsg = new SentNotificationRecord()
                    Id = 0,
                    CorrespondingEvent = t.ToString(),
                    ToCCRecipients = string.Join(";", ccList.ToArray())

                EmailSettingsLookup2(t, threadTitle, newMsg);

                    //message is recorded into the db here, with a default status of "sending"

                    WasRecorded = true;

                    //send the message. Send to is not used for now as all the destination recipients are sent emails in cc.
                    //So for now I send the message to myself + the "real" destinations in CC
                    var mailMessage = new MailMessage(newMsg.FromRecipient, newMsg.ToRecipients, newMsg.Subject, newMsg.MailText) { IsBodyHtml = false };

                    //from this method signature
                    ccList.ForEach(x => mailMessage.CC.Add(new MailAddress(x)));

                    //from config
                    newMsg.ReplyToRecipient.Split(';').ToList().ForEach(x => mailMessage.ReplyToList.Add(new MailAddress(x)));
                    newMsg.ToBCCRecipients.Split(';').ToList().ForEach(x => mailMessage.Bcc.Add(new MailAddress(x)));

                    /*SEND THE MESSAGE*/

                    newMsg.MailStatus = "sent";

                    Logger.Debug("Notification message sent to...\n\r {0} \n\r at {1}", ccList, DateTime.Now.ToLongDateString());
                    _notifier.Information(T("The email has been sent to recipient(s)"));
                catch (Exception e)
                    if (!WasRecorded)

                    Logger.Error(e, "An unexpected error while sending the email to {0} at {1}", ccList, DateTime.Now.ToLongDateString());
                    var errorMessage = string.Format("An unexpected error occured when sending your message.");
                string errorMessage = string.Format("Our email server isn't configured. You may email us directly at: {0}", "");


    public enum ebNotificationType
        ClosedTicket, OpenTicket,ThreadResult
Request for help is renewed.

Jan 29, 2014 at 9:50 AM
Any idea on this guys?
Jan 29, 2014 at 11:39 AM
Ohhh, for chrissake, forget me.
I just forgot to enable that referenced module.
Marked as answer by edtruant on 1/29/2014 at 3:39 AM