STA, debugging and testing



  •  So I have a COM object (written by me in C#) which I am consuming in a MFC unmanaged C++ app.

     I was passing a ptr to the COM object between threads, which I learned the hard way is not allowed due to the way STA works w/ the Message pump.  Thats fixed.  It leaves me wondering what other parts of the COM contract I'm disobeying due to ignorance.

    I read that I need a message pump in my COM object.  I find this kind of hard to believe, and nothing seems broken.  How does one go about testing a COM object?  Even though I was passing the ptr between threads the app didn't crash every time, so whats the right way to test this suff?

    Does a COM object in C# need to be in a strong-named assembly?

    Also, what's the right way to destroy a created COM object?  Just delete the pointer to it?



  • @Eric Shinn said:

    Also, what's the right way to destroy a created COM object?  Just delete
    the pointer to it?

    COM objects are freed by <font face="Courier New">IUnknown::Release()</font>.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.