Ken, thanks a lot, that was it! After adding
System.Runtime.InteropServices.Marshal.ReleaseComO bject(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.
"""Ken Slovak - [MVP - Outlook] ΠΙΣΑΜ(Α):
"""
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
the event handler before GC and instantiate a new object. I'd probably try
that as a belt and suspenders test to see if that works.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(tasksItems);
tasksItems = null;
GC.Collect();
GC.WaitForPendingFinalizers();
Then re-instantiate the tasksItems collection. See if that helps.
--
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
wrote in message
oups.com...
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
after unsubscription and just before subscription. Besides, I've
changed iteration through the collection to iteration through the
EntryIDs (I have them saved in my add-in). But the handler keeps
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...