
Signature
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
> Ken, thanks for your suggestion, but it didn't work. I've changed the
> unsubscription code and I've implemented a call of GC.Collect(); right
[quoted text clipped - 3 lines]
> catching an event on every item deleted. It appears I'll have to check
> in handler that event wasn't caught right after my cleaning...
Ken, thanks a lot, that was it! After adding
> System.Runtime.InteropServices.Marshal.ReleaseComObject(tasksItems);
> tasksItems = null;
> GC.Collect();
after unsubscription, Handler finally began no to catch delete event.
There was a problem when I also add GC.WaitForPendingFinalizers(); -
after executing this string outlook just stops responding, but without
it everything works just great.
"""
> Did you just call the GC or did you do that and wait for finalization of
> garbage collection? You might also have to release the COM object that has
[quoted text clipped - 23 lines]
> > catching an event on every item deleted. It appears I'll have to check
> > in handler that event wasn't caught right after my cleaning...
Ken Slovak - [MVP - Outlook] - 22 Nov 2006 14:49 GMT
Good.
The problem with the GC is that's it's non-deterministic. So you can release
something but the garbage collector might not get around to actually
releasing the references and cleaning things up for a while. In computer
code that seems like forever. Forcing collection releases things and gets
rid of those pesky event handlers.

Signature
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
> Ken, thanks a lot, that was it! After adding
>
[quoted text clipped - 6 lines]
> after executing this string outlook just stops responding, but without
> it everything works just great.