When you use OOM under .NET, your using managed code around COM objects via the Outlook Primary Interop Assembly (PIA). When you have managed code working with COM in this way, you have to be very careful to clean-up your references. .NET will hold onto COM objects, sometimes causing leaks, and sometimes reusing them (called COM Ressurection).
void onEvent_ItemSend( object Item, ref bool Cancel )
MessageBox.Show( "Application ItemSend Event Fired.", "onEvent_ItemSend" );
catch( Exception X )
MessageBox.Show( X.Message );
Basically any Outlook object is going to be COM based… and any com object not passed by reference (ie your passing by value) needs to to be cleaned-up – call Marshal.ReleaseCOMObject() on it and set it to null…
Here is another case:
foreach (Outlook.Attachment oAttach in oAttachs)
oAttach = null;
See, you need to specificly release the object. ForEach loops will will leak unless you do this. Of course, you could use a For/Next loop or use an enumerator.
OOM.NET: Part 2 - Outlook Item Leaks