标签
Raymond Chen 探讨了 CoreApplication.Properties 是否能管理不可封送对象的生命周期,并得出结论:使用可封送的包装器更简单,而 Properties API 在此场景中并没有带来实际价值。
Microsoft Old New Thing 博客文章解释了存储在 CoreApplication.Properties 中的非敏捷对象如何通过 RoGetAgileReference 被包装——导致它们在其宿主 apartment 关闭时过期,从而在 Properties 中留下一个中毒条目:HasKey 仍然报告其存在,但 Lookup 会以 E_INVALIDARG 拒绝请求。
The Old New Thing 解释了为什么 CoreApplication.Properties 中的条目在源单元关闭时似乎会失效:非敏捷 COM 对象会被包装在敏捷包装器中,虽然条目仍然存在,但一旦其所属单元退出,底层值就会变得不可用。
Raymond Chen 解释了为什么 RoRegisterForApartmentShutdown 不适合用于清理假 agile 包装器中不可编组的委托,详细说明了 agile 对象要求、注销警告、套间亲和性以及 O(n) 查找性能等方面的限制。
本文探讨了在C++中强制派生类实现特定非虚拟方法的技术,使用C++/WRL和C++/WinRT的示例,并批评了一个代码审查场景,其中仅使用注释而非适当强制。
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.
本文继续系列文章,介绍如何在 C++/WinRT 中实现敏捷委托,解决在正确上下文中销毁非敏捷委托的问题,方法是使用自定义删除器和 IContextCallback。
本文讨论了一个C++/WinRT模式,用于缓存Windows Runtime IAsyncOperation的结果,包括处理失败的情况,以便多个协程可以共享缓存的结果或异常。