Solved

Marshal.ReleaseComObject   use in VB.Net

Posted on 2009-04-08
2
880 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now