I am trying to develop an ATL COM object together with a C# web
application that will host it. I am following the COM Interop Part 1: C#
Client Tutorial, Example 2, The C# Code Approach from the April 2004
MSDN library exactly. But the client will not release the COM object.
The COM object is being run in its own solution and under a separate
instance of Visual Studio .NET 2003. At this point the object consists
only of the constructor, FinalConstruct, and FinalRelease. No methods or
properties have been implemented on the interface.
The C# client is the corresponding code according to the tutorial and is
in the code-behind of a .NET web form. No methods or properties on the
interface.
However, after I have run the simple
MyCOMTypeLib.MyCOMManager manager = new MyCOMTypeLib.MyCOMManager()
command and have exited either the debugger or the browser independent
of Visual Studio. A reference remains on MyCOM.dll. The dll cannot be
rebuilt and it cannot be deleted. The only way I have found to clear the
reference is to reboot the computer.
Is there a way for force the DLL to be unloaded? When programming ASP,
this could be done by unloading the application with the IIS manager.
Better yet, why is this reference remaining contrary to documentation? 6 2438
Hi..
Check out the Marshal.ReleaseComObject method. This method ensures that the
COM object is properly decremented so that the COM runtime will perform
proper clean up and unloading of the host (DLL).
John Puopolo
"Alan" <Al**@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com... I am trying to develop an ATL COM object together with a C# web application that will host it. I am following the COM Interop Part 1: C# Client Tutorial, Example 2, The C# Code Approach from the April 2004 MSDN library exactly. But the client will not release the COM object.
The COM object is being run in its own solution and under a separate instance of Visual Studio .NET 2003. At this point the object consists only of the constructor, FinalConstruct, and FinalRelease. No methods or properties have been implemented on the interface.
The C# client is the corresponding code according to the tutorial and is in the code-behind of a .NET web form. No methods or properties on the interface.
However, after I have run the simple
MyCOMTypeLib.MyCOMManager manager = new MyCOMTypeLib.MyCOMManager()
command and have exited either the debugger or the browser independent of Visual Studio. A reference remains on MyCOM.dll. The dll cannot be rebuilt and it cannot be deleted. The only way I have found to clear the reference is to reboot the computer.
Is there a way for force the DLL to be unloaded? When programming ASP, this could be done by unloading the application with the IIS manager.
Better yet, why is this reference remaining contrary to documentation?
Hi..
Check out the Marshal.ReleaseComObject method. This method ensures that the
COM object is properly decremented so that the COM runtime will perform
proper clean up and unloading of the host (DLL).
John Puopolo
"Alan" <Al**@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com... I am trying to develop an ATL COM object together with a C# web application that will host it. I am following the COM Interop Part 1: C# Client Tutorial, Example 2, The C# Code Approach from the April 2004 MSDN library exactly. But the client will not release the COM object.
The COM object is being run in its own solution and under a separate instance of Visual Studio .NET 2003. At this point the object consists only of the constructor, FinalConstruct, and FinalRelease. No methods or properties have been implemented on the interface.
The C# client is the corresponding code according to the tutorial and is in the code-behind of a .NET web form. No methods or properties on the interface.
However, after I have run the simple
MyCOMTypeLib.MyCOMManager manager = new MyCOMTypeLib.MyCOMManager()
command and have exited either the debugger or the browser independent of Visual Studio. A reference remains on MyCOM.dll. The dll cannot be rebuilt and it cannot be deleted. The only way I have found to clear the reference is to reboot the computer.
Is there a way for force the DLL to be unloaded? When programming ASP, this could be done by unloading the application with the IIS manager.
Better yet, why is this reference remaining contrary to documentation?
John,
Thank you for your response.
I tried that without success.
Stopping and restarting the web service does remove the reference. Not ideal.
"John Puopolo" wrote: Hi..
Check out the Marshal.ReleaseComObject method. This method ensures that the COM object is properly decremented so that the COM runtime will perform proper clean up and unloading of the host (DLL).
John Puopolo
"Alan" <Al**@discussions.microsoft.com> wrote in message news:7F**********************************@microsof t.com... I am trying to develop an ATL COM object together with a C# web application that will host it. I am following the COM Interop Part 1: C# Client Tutorial, Example 2, The C# Code Approach from the April 2004 MSDN library exactly. But the client will not release the COM object.
The COM object is being run in its own solution and under a separate instance of Visual Studio .NET 2003. At this point the object consists only of the constructor, FinalConstruct, and FinalRelease. No methods or properties have been implemented on the interface.
The C# client is the corresponding code according to the tutorial and is in the code-behind of a .NET web form. No methods or properties on the interface.
However, after I have run the simple
MyCOMTypeLib.MyCOMManager manager = new MyCOMTypeLib.MyCOMManager()
command and have exited either the debugger or the browser independent of Visual Studio. A reference remains on MyCOM.dll. The dll cannot be rebuilt and it cannot be deleted. The only way I have found to clear the reference is to reboot the computer.
Is there a way for force the DLL to be unloaded? When programming ASP, this could be done by unloading the application with the IIS manager.
Better yet, why is this reference remaining contrary to documentation?
John,
Thank you for your response.
I tried that without success.
Stopping and restarting the web service does remove the reference. Not ideal.
"John Puopolo" wrote: Hi..
Check out the Marshal.ReleaseComObject method. This method ensures that the COM object is properly decremented so that the COM runtime will perform proper clean up and unloading of the host (DLL).
John Puopolo
"Alan" <Al**@discussions.microsoft.com> wrote in message news:7F**********************************@microsof t.com... I am trying to develop an ATL COM object together with a C# web application that will host it. I am following the COM Interop Part 1: C# Client Tutorial, Example 2, The C# Code Approach from the April 2004 MSDN library exactly. But the client will not release the COM object.
The COM object is being run in its own solution and under a separate instance of Visual Studio .NET 2003. At this point the object consists only of the constructor, FinalConstruct, and FinalRelease. No methods or properties have been implemented on the interface.
The C# client is the corresponding code according to the tutorial and is in the code-behind of a .NET web form. No methods or properties on the interface.
However, after I have run the simple
MyCOMTypeLib.MyCOMManager manager = new MyCOMTypeLib.MyCOMManager()
command and have exited either the debugger or the browser independent of Visual Studio. A reference remains on MyCOM.dll. The dll cannot be rebuilt and it cannot be deleted. The only way I have found to clear the reference is to reboot the computer.
Is there a way for force the DLL to be unloaded? When programming ASP, this could be done by unloading the application with the IIS manager.
Better yet, why is this reference remaining contrary to documentation?
"Alan" <Al**@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com... John,
Thank you for your response.
I tried that without success.
Stopping and restarting the web service does remove the reference. Not ideal.
Release the object or release the DLL?
COM DLL's are unloaded when the process calls CoUnintialize, not when the
last reference of a contained object is released. If you need to unload
unused COM DLL's from memory you have to explicitely call
CoFreeUnusedLibraries through PInvoke.
Willy.
"Alan" <Al**@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com... John,
Thank you for your response.
I tried that without success.
Stopping and restarting the web service does remove the reference. Not ideal.
Release the object or release the DLL?
COM DLL's are unloaded when the process calls CoUnintialize, not when the
last reference of a contained object is released. If you need to unload
unused COM DLL's from memory you have to explicitely call
CoFreeUnusedLibraries through PInvoke.
Willy. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: JC |
last post by:
How does garbage collection work in C# and VB.NET for data returned from COM
object? For example, a COM object written in C++ returns a SAFEARRAY to C#
or VB.NET, will this SAFEARRAY (mapped to...
|
by: Trokey |
last post by:
I am making interop calls to an object in a .NET component from a C++
program and am leaking memory... the following is some sample code:
////////////////////////////////////////
// .NET...
|
by: Sorin |
last post by:
Hi all
I have a .NET application that is using few ActiveX DLL wrote in VB6. I
managed to get the most from my previous VB6 controls by using them in .NET
but sometimes when I am using my...
|
by: Nadav |
last post by:
Hi,
Introduction
***************
I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer,...
|
by: Nadav |
last post by:
Hi,
I have a .NET application that periodically creates COM objects, these
objects are created at one thread context and deleted in the other (
COmObjVar = null; ), FinalRelease NOT CALLED for...
|
by: Paul Perot |
last post by:
Hi All:
I need some help. I am using DSOFile.exe to examine and add and/or
manipulate some document and custom properties on a JPEG file. When the
document properties are correct, I would like...
|
by: William LaMartin |
last post by:
I have created a program that allows for the automation of things in Word
documents, like changing the values of DocVariables and the links to Excel
Sheets. I did it using interoperoperatability,...
|
by: Tim |
last post by:
I have a class called Manager. In the 'Initialize' method of the Manager
class, I create an instance of a COM class (say oComObject). What is the
lifetime of oComObject. Will it be available as...
|
by: Richard Lewis Haggard |
last post by:
I am trying to create multi-dimensioned arrays in conventional ASP pages and
pass these arrays as arguments to functions that are in a C# interop
assembly. ASP complains because it doesn't...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |