Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Marshal.ReleaseComObject   use in VB.Net

Posted on 2009-04-08
2
Medium Priority
?
911 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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

877 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