Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You've left out some critical information about your own application, including most importantly how you are implementing the COM interfaces that you expose to the client application. One aspect of your description that is a red flag for me is the instantiation of your application. You say that the client application is, "using VB to start a new process by referencing our exe." This shouldn't be necessary if you've properly implemented and registered your COM server. Let me tell you the architecture I would use to accomplish what you ask, and hopefully this will be useful to you.</p> <p>To begin with, if you want to provide a COM object from within a separate process, the proper way is to implement a COM out of process server. With an out of process server, COM will start your application automatically when a client requests one of your interfaces through COM. Part of the implementation requirements of an out of process server is to shut down automatically when the last COM client releases their last interface pointer.</p> <p>In order to expose a user interface from the out of process server, you'll want to spawn a separate Single-threaded Apartment (STA) thread with a message loop. This will allow you to close any window on the STA thread, including the main window, without killing your COM server. That's because the COM server implementation will be running it's own Multi-threaded Apartment (MTA) message loop thread to support the COM out of proc calls. The MTA thread is the main application thread, and the server will shut down it down when the last client interface is released.</p> <p>A COM server <em>should not</em> shut down while interfaces remain unreleased. This means the client application has a responsibility to release interfaces properly. But your .NET test frame should have done this, so it appears something is not right with your implementation.</p> <p>Assuming you follow this guidance, you will need a plan for handling the scenario in which the last client interface is release but you still have open UI windows. Once you get everything set up correctly, this shouldn't be a major problem. For example, you can simply take a reference to one of your own interfaces while the UI is open, this would prevent an MTA shutdown.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload