Tag
Raymond Chen explores whether CoreApplication.Properties can manage the lifetime of a non-marshalable object, concluding that a marshalable wrapper is simpler and that the Properties API adds no real value for this scenario.
A Microsoft Old New Thing blog post explains how non-agile objects stored in CoreApplication.Properties are wrapped via RoGetAgileReference, causing them to expire when their host apartment shuts down—leaving a poisoned entry in Properties that HasKey still reports but Lookup rejects with E_INVALIDARG.
The Old New Thing explains why entries in CoreApplication.Properties appeared to expire when the source apartment shut down: non-agile COM objects get wrapped in agile wrappers, and while the entry persists, the underlying value becomes unusable once its apartment exits.
Raymond Chen explains why RoRegisterForApartmentShutdown wasn't suitable for cleaning up an unmarshalable delegate in a fake agile wrapper, detailing constraints around agile object requirements, unregistration warnings, apartment affinity, and O(n) lookup performance.
The article discusses techniques in C++ to enforce derived classes to implement a specific non-virtual method, using examples from C++/WRL and C++/WinRT, and critiques a code review scenario where comments were used instead of proper enforcement.
Raymond Chen explains how to use std::unique_ptr to manage a registration cookie in a fake agile wrapper, discussing integer-to-pointer round-tripping and the wil::unique_any alternative.
Raymond Chen continues his series on creating a fake agile wrapper for non-marshalable COM objects by wrapping them in a marshalable object, enabling registration in the global interface table while preserving undefined-behavior-free failures in other apartments.
This article continues a series on implementing agile delegates in C++/WinRT, addressing the issue of destructing non-agile delegates in the correct context using a custom deleter and IContextCallback.
The article discusses a C++/WinRT pattern for caching the result of a Windows Runtime IAsyncOperation, including handling failures, so that multiple coroutines can share the cached result or exception.