Why didn’t we use the COM static store to clean up the unmarshalable delegate?
cppdashboard.dev/r/2026/10/why-didn-t-we-use-the-com-static-store-to-clean-up-the-unmarThis article discusses the limitations of using the COM static store for managing unmarshalable delegates, particularly in the context of single-threaded apartments in UWP applications.
From the article
A third suggestion from Luca Bacci on creating a fake agile wrapper that is technically agile but is not useful outside its home apartment was to use the COM static store .
The COM static store doesn’t help us, because the COM static store runs down when the last thread shuts down COM, whereas we want something that runs down when a single apartment shuts down COM.
There is a per-apartment version of the COM static store, but it is part of the CoreApplicationView , which is (1) something that only UWP programs have, and (2) exists only for apartments that have a core application view, and those are restricted to single-threaded apartments.
Share this resource