Outlook Redemption (Redemption.dll) and Background Threading do not mix.

, ,

Outlook Redemption is a very nice library which allows access to many Outlook functions many of those not exposed via the Outlook object model. We are currently using Redemption in our application to add outlook appointments with reminders, pop email messages with pre-populated information, etc.

We wrapped the Redemption.dll into our own Singleton class and called it OutlookRedemption as you will see in the following code examples.

We have had a couple of situations where emailing from our application stops working or works intermittently and in both of those occurrences, the culprit was using the API in a back ground thread.

Recently while doing a round of application optimization, one of my colleagues decided to place the code that Authenticates into the ExchangeMailbox in a BackgroundWorker thread (highlighted in blue):

using (BackgroundWorker outlookLoader = new BackgroundWorker())
{
outlookLoader.DoWork +=new DoWorkEventHandler((s,b) => { OutlookRedemption.Instance.Logon(); });
outlookLoader.RunWorkerAsync();
}

We did a release and it took a little while to figure out that it was the background thread that was our problem. It did not make sense to put this operation in a background thread as this code is executing during application start up and it does not block the main thread but for a few milliseconds.

In order to resolve the problem, we simply got rid of all the code except for this:

OutlookRedemption.Instance.Logon(); 

Life was good again.

On another occasion we had a developer write this code:

using (BackgroundWorker outlookLoader = new BackgroundWorker())
{
string subject = “email subject”;
string to = “hlc@somedomain.com”;
// send the email
OutlookRedemption.Instance.PopEmail(subject, “email body”, to);
});

We did a release that included the code above and we started getting reports from our users that emailing out of our application was working sometimes and not working other times. We tested and verified with our own eyes that this was the case. A popular feature was working intermittently.

After getting rid of the background thread code and just letting the UI thread take care of popping the Outlook email the problem went away and life was good again:

OutlookRedemption.Instance.PopEmail(subject, “email body”, to);

The End.


2 responses to “Outlook Redemption (Redemption.dll) and Background Threading do not mix.”

  1. There is the main benefit of anonymity, allowing people to gamble without the need to give their personal information such as credit card number, name and address. Winning money is the number one reason people choose casinos in the first place and you can win substantially if you play right. There are almost no fees attached, because there are no intermediaries, such as banks or governmental institutions that administrate money. Let´s not forget about earnings and how considerable they are for cryptocurrencies. Besides the usual advantages that arise from gambling at an online casino, there are certain advantages for Bitcoin casinos. Everyone has a game where they have higher chances and if you know yours, then even better.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.