winrt

Tag

Cards List
#winrt

Could we use the CoreApplication Properties to manage the lifetime of an object that refuses to be marshaled?

The Old New Thing (Raymond Chen) ↗ · 4d ago Cached

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.

0 favorites 0 likes
#winrt

What happens when you put a non-agile object in the CoreApplication Properties?

The Old New Thing (Raymond Chen) ↗ · 5d ago Cached

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.

0 favorites 0 likes
#winrt

Why did it seem that the entries in the CoreApplication Properties expired when the source application shut down?

The Old New Thing (Raymond Chen) ↗ · 6d ago Cached

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.

0 favorites 0 likes
#winrt

Why didn’t we use Ro­Register­For­Apartment­Shutdown to clean up the unmarshalable delegate?

The Old New Thing (Raymond Chen) ↗ · 2026-10-21 Cached

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.

0 favorites 0 likes
#winrt

On forcing all derived classes to implement a specific non-virtual method, part 1

The Old New Thing (Raymond Chen) ↗ · 2026-08-27 Cached

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.

0 favorites 0 likes
#winrt

Creating a fake agile wrapper that is technically agile but is not useful outside its home apartment, part 5

The Old New Thing (Raymond Chen) ↗ · 2026-08-07 Cached

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.

0 favorites 0 likes
#winrt

Creating a fake agile wrapper that is technically agile but is not useful outside its home apartment, part 3

The Old New Thing (Raymond Chen) ↗ · 2026-08-05 Cached

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.

0 favorites 0 likes
#winrt

Making an agile version of a Windows Runtime delegate in C++/WinRT, part 5

The Old New Thing (Raymond Chen) ↗ · 2026-07-24 Cached

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.

0 favorites 0 likes
#winrt

Sharing the result of a single Windows Runtime IAsyncOperation among multiple coroutines, part 3

The Old New Thing (Raymond Chen) ↗ · 2026-05-29 Cached

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.

0 favorites 0 likes
← Back to home

Submit Feedback