Since I just spent a bunch of time trying to figure out why our Addin was causing Outlook to hang on shutdown:
Do not capture references to Outlook VSTO objects (like Explorer objects), in your anonymous event handler delegates. Since there is no way to release these, the references to these objects cannot be garbage collected. Outlook will dutifully wait for this to happen before shutting down, and since it doesn't, it will hang.
Since you can't count on the Addin.Shutdown event to be fired in Outlook 2010, you must be very careful where you keep references to any Outlook VSTO objects in general. I would recommend NOT keeping any references. For instance, don't store a reference to the Explorer object in your AddIn class. Use Application.ActiveExplorer() if you need to get the Explorer object.
On a more general not about lambda expressions and anonymous methods - use them with care as event handlers. Unless you jump through a lot of hoops, you can't easily remove them from the handler chain so they will live for as long as the event publisher does. If that is the lifetime of your application, then any objects captured by your handlers will also live for the life of your application (who says you can't leak memory in .NET).
I've recently read a lot of articles about WeakEventHandlers, WeakReferences, etc. as it relates to solving this problem. The "correct" way to solve it is to explicitly remove event handlers when they are no longer used, thus releases the resources those handlers captured. However, there is no syntactically clean way to do this currently in .NET, and all of the clever ways I've seen written to do it far outway the syntactic advantage of using anonymous methods.
What is needed is a way to get a reference to an anonymous delegate when it is added to the event chain so that you can use it later when you are ready to clean up. I suspect that most people simply don't worry about cleaning up event handlers.
Right now, it looks like this:
someevent += () => {//Do event work here};
How would you remove this event handler? Answer, you can't!
Alternatives should be:
AnonymousHandler handler = someevent += () => {//Do event work here};
so that later you could:
someevent -= handler;
That's not supported by the language, however, so if you want to use anonymous delegates you pretty much are trading off the ability to elegantly clean up after yourself. I've always liked the idea of symmetry in code - for every new, a delete (not suppoted in c#, unfortunately), for every Create, a Destroy, for Init, a Kill, for AddRef, a Release. This is an example where the language doesn't support symmetry, and it should be fixed!