"Empty the Deleted Items folder upen exiting" not run when installedmy Outlook Addin

S

Sven Ziehe

Hello Newsgroup,

i hope any specialist can help me.
I have a addin that overrides the Out of Office Assistent.
It's written in vb.net 2005 and VSTO SE.
if the Addin is loaded and i open a second Explorer, close it and
close the Application then the Emtpy deleted Items Option not run.
If i use only one Explorer in Outlook i have no Problems.

Has anybody a Idea, how can i solve this Problem?

Thanks,

Sven Ziehe
 
K

Ken Slovak - [MVP - Outlook]

Are you using an Explorer wrapper class and collection or list of those
wrapper classes?
 
S

Sven Ziehe

Hello Ken,

thanks for your answer,

the Design of the Addin is follow.
The VSTO Addin loads over reflection any "Features" from separate
Assemblys with a implemented Interface.
Creates a Instance of this Class, load UI and store it in a Collection
of BaseClass.
If a new Explorer event is fired, the loaded Features creates a Tracker
and store it in a Collection.
is the Explorer Close Event is fired, the Tracker raises a Event to
Remove himself from the Collection.
The Explorer is Released with
system.Runtime.InteropServices.Marshal.ReleaseComObject.

I hope you can understund me.

Thanks,

Sven
 
K

Ken Slovak - [MVP - Outlook]

It sounds like you're not correctly tracking and disposing of your objects
or wrappers. Are you getting OnDisconnection and BeforeShutdown? Is Outlook
still hanging in memory? If so you're not releasing everything.
 
S

Sven Ziehe

sorry for the late answer.
Outlook is not hanging in Memory.I using only BeforeShutdown Event to
dispose all Objects.

Dispose in the Base Class:

Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
Unload()
End If
If Not Me.Explorers Is Nothing Then _
Do While
System.Runtime.InteropServices.Marshal.ReleaseComObject(Me.Explorers) >
0 : Loop

If Not Me.Inspectors Is Nothing Then _
Do While
System.Runtime.InteropServices.Marshal.ReleaseComObject(Me.Inspectors) >
0 : Loop

If Not Me.Application Is Nothing Then _
Do While
System.Runtime.InteropServices.Marshal.ReleaseComObject(Me.Application)

End If
Me.disposedValue = True
End Sub

Unload from Implementation:

RemoveHandler _btnOOF.Click, AddressOf Me._btnOOF_Click
Do While
Runtime.InteropServices.Marshal.ReleaseComObject(Me._btnOOF) > 0 : Loop
Do While
Runtime.InteropServices.Marshal.ReleaseComObject(Me.Explorer) > 0 : Loop

Dispose Tracker:

Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' Me._addin.Dispose()
End If

Runtime.InteropServices.Marshal.ReleaseComObject(Me._Explorer)
End If
Me.disposedValue = True
End Sub

BeforeShutdown:

For Each c As brose.addin.base In addins
c.Dispose()
Next
addins.Clear()
addins.olApp = Nothing


Thanks for your Help!

Sven
 
K

Ken Slovak - [MVP - Outlook]

Is BeforeShutdown firing and does your Dispose call get called from there?

I usually use a call from BeforeShutdown just as a safety precaution. Mostly
I depend on the Explorer.Close event to release all my Outlook object when
Me.Explorers.Count <= 1 And Me.Inspectors.Count = 0.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top