Solved

Marshal.ReleaseComObject   use in VB.Net

Posted on 2009-04-08
2
899 Views
Last Modified: 2012-05-06
I am trying to use this:
While xxxxxx <> 0
    System.Runtime.InteropServices.Marshal.ReleaseComObject(xxxxxx)

I am trying to execute this statement just before I exit a COM class.  Is xxxxxx the Com class name?  Can I release it when I am still in it?

Can you provide a while loop where xxxxxx = the com clas name and is the only COM component

 

0
Comment
Question by:garyinmiami2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 24100646
Unless I am missing something, xxxxxx is a variable holding a reference to your COM object. When in your While loop, you are not "in" the COM. Your COM object exists regardless of your loop. Your loop is saying "keep trying to release (ReleaseComObject) this object until the variable xxxxxx points to 0 and not to a COM object."
0
 

Author Comment

by:garyinmiami2003
ID: 24102156
I would like to clarify a little

Suppose there is a COM Class in a class library and it has been installed on your pc.  The method called in the class begins

Public Function Broker(ByVal extensionData As thirdparty..IFaExtensionData)

(    all kinds of code)


System.Runtime.InteropServices.Marshal.ReleaseComObject(extensionData)

end Function

My question is:  Is this necessary?  Is this the correct way to use it, if it is necessary?






                                       
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question