Handling events from out-of-proc COM server in managed STA application

前端 未结 1 1415
温柔的废话
温柔的废话 2020-12-02 00:44

Apparently, managed handlers for events, sourced from an unmanaged out-of-process COM server, are called back on a random pool thread, rather than on the main STA thread (

相关标签:
1条回答
  • 2020-12-02 01:42

    I've found the following excerpt from Adam Nathan's ".NET and COM: The Complete Interoperability Guide":

    If the COM object lives in an STA, any calls from MTA threads are marshaled appropriately so the COM object remains in its world of thread affinity. But, in the other direction, no such thread or context switch occurs.

    Thus, this is the expected behavior. So far, that's the only (semi-official) source on the subject I could find.

    0 讨论(0)
提交回复
热议问题