VB.net Marshal.ReleaseComObject Yes/No?

Hi
I was led to assume that the best way to release a COM object is by using the following code
Dim oAppt As Microsoft.Office.Interop.Outlook.AppointmentItem
{Code Inbetween}
If Not oAppt Is Nothing Then Marshal.ReleaseComObject(oAppt)

but in my web surfing I came across the following artcle
http://blogs.msdn.com/b/visualstudio/archive/2010/03/01/marshal-releasecomobject-considered-dangerous.aspx

Is it safe or not to release objects this way. Is there a better/safer way?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
I do not have time to read the referenced article, but it surely will (although things might have changed in later versions of Visual Studio)

To answer your question anyway, give a look at who wrote the blog in your post: The official source of product insight from the Visual Studio Engineering Team.

I would think that these guys know what they are talking about. They are the guys who designed and wrote the code for that stuff.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
That article points to this article, which has some caveats about Marshal.ReleaseComObject:

http://blogs.msdn.com/b/cbrumme/archive/2003/04/16/51355.aspx

If you are using a COM object in a scoped, single-threaded manner then you can safely call ReleaseComObject on that object when you are done with it.  This will eagerly release any unmanaged resources associated with that object.  Subsequent calls would get an InvalidComObjectException.  So don’t make subsequent calls.

If you are using a COM object from multiple places or multiple threads in your application (or from other applications in the same process), you should not call ReleaseComObject.  That’s because you will inflict InvalidComObjectExceptions on those other parts of the application.
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.