Click here to Skip to main content
16,004,944 members
Home / Discussions / COM
   

COM

 
Questionwebservice Pin
brsecu6-Jul-07 3:39
brsecu6-Jul-07 3:39 
AnswerRe: webservice Pin
Thomas Chester9-Jul-07 8:04
Thomas Chester9-Jul-07 8:04 
Questionwhat should i do? Pin
eraccn5-Jul-07 17:30
eraccn5-Jul-07 17:30 
QuestionCall function in remote DLL Pin
Dimkov5-Jul-07 8:06
Dimkov5-Jul-07 8:06 
QuestionATL wizard not adding Get and Put function prototypes to the class definition. Pin
KASR15-Jul-07 1:24
KASR15-Jul-07 1:24 
Questionintegrating COM in a XBAP wpf application Pin
elkev4-Jul-07 22:34
elkev4-Jul-07 22:34 
Questiontimeout breaks object descruction Pin
sdevil13-Jul-07 9:45
sdevil13-Jul-07 9:45 
AnswerRe: timeout breaks object descruction Pin
Mike Dimmick14-Jul-07 7:00
Mike Dimmick14-Jul-07 7:00 
I think your problem here is actually in how the .NET Framework uses COM objects.

When you create a COM object in .NET code, the Framework generates something called a Runtime Callable Wrapper. The Framework does not call AddRef on your component every time the .NET code makes a copy of the interface pointer. It only calls Release when it destroys the RCW. Instead, it performs traced references with the garbage collector - if the GC detects there are no outstanding references to the RCW it then marks it for collection.

So what calls Release? I'm not too sure on this one, but I think the RCW ends up on the finalization queue, and then the finalization thread is responsible for calling Release. Unfortunately, there is a total of one finalizer thread in the system (separate from all the application threads, so you can get cross-threading problems) and it can easily get blocked.

I think what's happening for you is that the finalizer thread isn't being allowed to run to completion on process shutdown.

My personal best practice is to do everything possible to avoid finalization. That means calling Dispose on everything as soon as I've finished with it - the using block in C# (and VB 8.0) can help a lot here. Unfortunately again, the RCW doesn't implement IDisposable and cannot be disposed of in this way.

The only documented way to dispose of a COM object explicitly is to call Marshal.ReleaseComObject. However, this function does not trace references and can prematurely delete an object that is still actually in use, so use it carefully.

It is probably better to add an explicit way of allowing the client to close down the object, rather than relying on FinalRelease.

Stability. What an interesting concept. -- Chris Maunder

QuestionWhy we need COM? Pin
Nandu_77b3-Jul-07 1:22
Nandu_77b3-Jul-07 1:22 
AnswerRe: Why we need COM? Pin
Steve S3-Jul-07 2:12
Steve S3-Jul-07 2:12 
GeneralRe: Why we need COM? Pin
Nandu_77b3-Jul-07 4:26
Nandu_77b3-Jul-07 4:26 
GeneralRe: Why we need COM? Pin
Steve S4-Jul-07 1:53
Steve S4-Jul-07 1:53 
AnswerRe: Why we need COM? Pin
CPallini3-Jul-07 2:17
mveCPallini3-Jul-07 2:17 
GeneralRe: Why we need COM? Pin
Nandu_77b3-Jul-07 5:50
Nandu_77b3-Jul-07 5:50 
AnswerRe: Why we need COM? Pin
Michael Dunn4-Jul-07 13:39
sitebuilderMichael Dunn4-Jul-07 13:39 
QuestionActiveX Pin
Anil K P1-Jul-07 22:52
Anil K P1-Jul-07 22:52 
Questionunderstanding COM Pin
KASR11-Jul-07 21:32
KASR11-Jul-07 21:32 
AnswerRe: understanding COM Pin
CPallini1-Jul-07 22:01
mveCPallini1-Jul-07 22:01 
QuestionNot able to create folders on exchange 2003 on Windows 2003 Pin
kaushik_Manoj1-Jul-07 19:11
kaushik_Manoj1-Jul-07 19:11 
QuestionHow to datas import in Grd to Excel sheet Pin
Ranjith Joseph Selvaraj29-Jun-07 23:47
Ranjith Joseph Selvaraj29-Jun-07 23:47 
QuestionSetting computer name with WMI Pin
one-trick-pony29-Jun-07 7:07
one-trick-pony29-Jun-07 7:07 
Questionusing asp.net2.0, in case of Gridview control if we dont use Sqldatasource control ,can we use inbuilt edit update.. functionality? Pin
yogita charhate28-Jun-07 23:29
yogita charhate28-Jun-07 23:29 
QuestionMulti threading in c++ [modified] Pin
role127-Jun-07 20:25
role127-Jun-07 20:25 
AnswerRe: Multi threading in c++ Pin
Jürgen Jung1-Jul-07 21:26
Jürgen Jung1-Jul-07 21:26 
QuestionHow to Deploy Presentation Layer and COM + in two servers? Pin
Sylvester george27-Jun-07 19:04
Sylvester george27-Jun-07 19:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.