Dynamics SL 2011 - Object Model - Applications Still Running

I am in the process of converting a Solomon Object Model project from version 6.5 to version 2011. When I try to log out, I get an "Applications Still Running" error. Here is my code:

Try
Thread.Sleep(5000)
' Quit the application
sivApp.Quit()
sivApp = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
' Shut down the toolbar
sivTB.Logout()
sivTB.Quit()
sivTB = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
Catch ex As Exception
ErrorLog(fund + ": Error Logging Out of " + fund + Environment.NewLine + "File Processing has been Stopped.", Err.Description)
' errorcount = errorcount + 1

End Try

When I run the line "sivTB.Logout()" I get the error "Logout Error: Applications Still Running.".
Has anyone else run into this before?

Related
Recommended