MimeKit icon indicating copy to clipboard operation
MimeKit copied to clipboard

Migrating from MimeKit 2.15.1 to 3.0.0

Open ajtruckle opened this issue 2 years ago • 2 comments

Hello !

Since this is a significant version number increase are there any code breaking changes to be aware of?

Thank you in advance.

ajtruckle avatar Dec 14 '21 09:12 ajtruckle

Hi @ajtruckle,

I noticed that the changelog is here: https://github.com/jstedfast/MimeKit/blob/master/ReleaseNotes.md! It seems complete, maybe it could be useful to add a breaking change symbol on any critical points...

ghost avatar Dec 14 '21 16:12 ghost

Hi guys,

Thanks for this question.

For the most part, if your code compiled with MimeKit 2.15 w/o any [Obsolete] warnings, then it'll likely compile fine in 3.x as well.

One exception to this are if you subclassed OpenPgpContextBase, OpenPgpContext or GnuPGContext to override anything more than the GetPassword() method. Even there, I tried to more-or-less maintain the existing API, I just shuffled methods around between them and dropped OpenPgpContextBase by moving those methods/properties back into OpenPgpContext.

The only other exception I can think of is that I changed a number of the protected virtual methods on X509CertificateDatabase to take an IDbConnection argument to provide more context to subclasses.

MailKit has more extensive API changes, but I tried to maintain API compatibility as much as possible by adding extension methods that map to the newer API. The main changes there were that there were just way too many IMailFolder methods to reasonably implement if anyone ever tried to implement an mbox or maildir-type backend using the MailKit interfaces.

What I did was to replace the dozens of Fetch() method overloads with all the variations of optional arguments with a single IFetchRequest argument (and a FetchRequest class that implements that interface). This makes it much easier to maintain the code if any new IMAP extensions are published that extend the FETCH command as well.

I also did the same thing for Add/Remove/SetFlags() and Append()/Replace().

I'll keep this open for a bit in case anyone else has any questions or if there's anything else that comes to my mind.

I think there are likely a lot of people that will be interested in this question.

jstedfast avatar Dec 14 '21 18:12 jstedfast