login about faq


I am using the Chilkat.MailMan and every month or so the component start throwing errors on sending emails: The type initializer for '<Module>' threw an exception. Restarting the app IIS pool application seem to fix the issue(running app on windows 2008 R2), but I keep having to do this every month or so, is it a known issue? and how can I fix it permanently?



asked Mar 21 '13 at 10:53

Alex's gravatar image


Tough to say without seeing an actual error message or some code.

Usually when things suddenly stop working after an extended period of time it's due to something like running out of memory/resources (are you disposing of all objects properly? in the TaskManager does it appear that your software is using a lot of resources when it dies?), or perhaps an overflow problem (for example, 32-Bit GetTickCount calls roll-over after 49.8 days, and this has been known to cause problems in long running code that hasn't been designed to account for it).

Any additional concrete information you can supply can only help though, such as:

  • Contents of the LastErrorText property on the MailMan object when the error occurs
  • The exact Exception number/text
  • A code snippet where the error is occurring

Also make sure that you are using the latest builds of the DLLs (should be Dec 12, 2012)


answered Mar 21 '13 at 16:46

jpbro's gravatar image

jpbro ♦

I am still experiencing the same isssue and I have to recycle the application pool to resolve every 24 to 48 hours.

Any other thoughts on possible fixes?



(Mar 29 '13 at 15:45) Alex

Thank you for your response,

it is hard to distinguish which iis worker process the app is, as I have quite a few sites on the server and they all have the name of w3wp.exe*32.

I don't know how to handle the GetTickCount you mentioned.

I am using Chilkat

I think you might be right on the resource concern, the snippet below is from the function that calls the chilkat component:

Chilkat.MailMan mailman = new Chilkat.MailMan();

            bool success;
            success = mailman.UnlockComponent("xxxxx");
            if (success != true)
                LogToDB("Chilkat Component unlock failed", "");
                return false;

            //  Use the GMail SMTP server
            mailman.SmtpHost = "xxxx";
            mailman.SmtpPort = 25;

            //  Set the SMTP login/password.
            mailman.SmtpUsername = "something@xyz.com";
            mailman.SmtpPassword = "Password";
            mailman.StartTLS = true;

            string cid;
            //  Create a new email object
            Chilkat.Email email = new Chilkat.Email();


            email.Subject = Subject;

            email.From = "something@xyz.comm";

            success = mailman.SendEmail(email);

            if (success != true)
                GlobalTracker.LogToDB("Chilkat Send Error", mailman.LastErrorText);
                sent = false;
                sent = true;

I will add the email.Dispose(); mailman.Dispose(); and see if that resolves the problem.


answered Mar 22 '13 at 10:07

Alex's gravatar image


edited Mar 22 '13 at 10:08

For questions such as this, the best thing to do is to Google the error message. For example, Googling "type initializer for '<module>' threw an exception" provides many good results.

I suspect this isn't an issue caused by the Chilkat .NET assembly. Please do some research by Googling the error message to understand the meaning of the error message in more detail...


answered Mar 30 '13 at 16:53

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Mar 21 '13 at 10:53

Seen: 3,936 times

Last updated: Mar 30 '13 at 16:53

powered by OSQA