Releases: microsoft/cppwinrt
3.0.260520.1
Major additions and breaking changes
In addition to the usual bugfixes and enhancements, this first 3.0 release contains two major updates: support for C++20 modules, and support for deprecated pre-standard coroutines has been removed.
Removing pre-standard coroutines
C++/WinRT has removed support for the pre-standard coroutines via the /await compiler option and the <experimental/coroutine> header. This aligns with the new behavior in the MSVC Build Tools 14.50 (shipping in Visual Studio 2026) that officially deprecated /await, and will soon deprecate the experimental headers. Standard coroutines are available by default starting in C++20, or if you are still on C++17, use /await:strict.
If your existing projects are using the Nupkg support out of the box and have not manually added /await, you probably won't have to change anything, as we've updated the default behavior in Microsoft.Windows.CppWinRT.targets to use /await:strict when building with C++17. If for some reason, you need to override this default behavior in the targets file, you can set CppWinRTEnableCpp17Coroutines to false to prevent it from auto-setting /await:strict.
Module support
Full module support has finally arrived to C++/WinRT! Replace
#include <winrt/Windows.Foundation.h>with
import winrt.Windows.Foundation;and rejoice!
This brings potential improvements in build speed, disk space, and memory usage, particularly for large projects using Xaml projections, and starts to isolate more of the internal C++/WinRT implementation details from the consumer side. Test-driving this work on a quick and dirty prototype fork of Windows Terminal yielded a 10-15% build speed improvement (22 minutes before, 19 minutes after), and a reduction in disk space from 30GB down to 18GB.
If you've ever used C++/WinRT with Windows.UI.Xaml.*, you've probably moved those headers into your precompiled header (PCH), but then saw your PCH consume well upwards of 1-2GB of disk space per vcxproj, per flavor. In the Terminal prototype, taking these headers out of the PCH and replacing them with a single cppwinrt module, built once and shared between projects, the PCHs shrunk by upwards of 80%, and the time to build each PCH went from ~40 seconds down to ~5 seconds. The single prebuilt cppwinrt modules carried all of the types for the entire Windows.* namespaces and WinUI, and still consumed only 700MB, and took ~80-90 seconds to build. Excluding unused namespaces from the module build can lower those numbers even further. The Terminal prototype didn't do this, and still enjoyed immediate wins on disk space, and the build time wins broke even after converting about 2-3 projects out of the ~15 or so that use C++/WinRT.
As part of this large effort, we no longer generate the old monolithic module interface file winrt.ixx, but instead generate a module interface .ixx file for each WinRT namespace. There is more documentation at nuget/modules/md to help get you started.
What's changed
- Enable NuGet Central Package Management by @DefaultRyan in #1483
- Declare public LTO visibility for ABI type declarations by @ZeroMemes in #1482
- All cppwinrt vcxproj should build with /W4 and /WX (warnings turned up, treated as error). Fix existing violations. by @dmachaj in #1487
- fix indent in generated code by @dlech in #1489
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #1502
- Bump actions/download-artifact from 4 to 5 by @dependabot[bot] in #1501
- Bump actions/stale from 9 to 10 by @dependabot[bot] in #1507
- Fix CI build by using latest Windows SDK in C# project by @DefaultRyan in #1516
- Remove throwing/originating errors in expected scenarios (Lookup/TryLookup and Cancel) by @antmor in #1512
- Bump actions/download-artifact from 5 to 6 by @dependabot[bot] in #1519
- Bump actions/upload-artifact from 4 to 5 by @dependabot[bot] in #1518
- Bump actions/checkout from 5 to 6 by @dependabot[bot] in #1523
- Bump actions/upload-artifact from 5 to 6 by @dependabot[bot] in #1525
- Bump actions/download-artifact from 6 to 7 by @dependabot[bot] in #1526
- Enable PreFast for build stage in OneBranch pipeline by @vineeththomasalex in #1533
- Update PreFast run stage in OneBranchBuild.yml to "Guardian" to avoid race condition with build. by @vineeththomasalex in #1534
- Remove Windows pool from build stage by @vineeththomasalex in #1535
- Only sign the VSIX contents instead of the entire temp directory by @DefaultRyan in #1537
- Fix handling of NuGet package version in VSIX by @DefaultRyan in #1536
- Fix accidentally deleted parameter by @DefaultRyan in #1538
- Delete stale.yml by @StephanTLavavej in #1543
- Bump actions/download-artifact from 7 to 8 by @dependabot[bot] in #1541
- Bump actions/upload-artifact from 6 to 7 by @dependabot[bot] in #1542
- Simplify the definition of the consume function by @YexuanXiao in #1544
- Remove experimental coroutines support by @sylveon in #1521
- Add missing headers and std qualification, use std::numeric_limits in… by @YexuanXiao in #1546
- Fix race condition in multi_threaded_observable_map test by @DefaultRyan in #1550
- Fix integer fields causing impl promotion by @sylveon in #1551
- box_value constructor: Replace param::hstring with hstring by @justanotheranonymoususer in #1530
- fix: normalize CRLF to LF in test/test/box_string.cpp by @Copilot in #1557
- Breaking coroutines means v3.0 by @DefaultRyan in #1547
- Add inline for hstring_reference_flag by @YexuanXiao in #1571
- CI: test against VS2022 (v143) and VS2026 (v145) in parallel by @Copilot in #1573
- Move operator<< to winrt::Windows::Foundation by @YexuanXiao in #1576
- C++20 module support v2 by @DefaultRyan in #1575
New Contributors
- @ZeroMemes made their first contribution in #1482
- @antmor made their first contribution in #1512
- @vineeththomasalex made their first contribution in #1533
- @StephanTLavavej made their first contribution in #1543
- @YexuanXiao made their first contribution in #1544
- @justanotheranonymoususer made their first contribution in #1530
- @Copilot made their first contribution in #1557
Full Changelog: 2.0.250303.1...3.0.260520.1
2.0.250303.1
What's Changed
- Use
actions/cache@v4by @jsoref in #1411 - Spelling by @jsoref in #1412
- Changed visibility of
observable_map_base::call_changedtoprotectedby @Patschkowski in #1425 - Add missing
<exception>to base_includes.h by @m417z in #1427 - Add NuGet config by @manodasanW in #1433
- Update NuGetCommand to use nuget.config by @manodasanW in #1434
- Clarify how InitializeComponent works in the template comment by @la-thorn in #1435
- Silence clang-tidy "unused variable" warnings by @dunhor in #1438
- Value-init fields of WinRT structs (fix warning C24695 in generated code) by @DefaultRyan in #1443
- Bug: Projected winrt::consume_ methods will nullptr crash if the underlying QueryInterface call fails by @dmachaj in #1442
- WINRT_SOURCE_LOCATION has ODR checks that prevent mixing cpp17 and cpp20 static libraries by @dmachaj in #1444
- Latest vpack has an extra cppwinrt folder by @DefaultRyan in #1447
- Reduce the code size of generated consume methods by skipping casts when the type is already a match by @dmachaj in #1448
- try_as casts should not store COM error context; consume method cast checking should use return codes directly by @dmachaj in #1450
- Try to fix the disabled/failing nuget test build step by @dmachaj in #1451
- GitHub Actions workflow cannot build arm32 after updating Windows SDK by @dmachaj in #1454
- The new variables in winrt::impl::consume_ methods can collide with parameters to that method by @dmachaj in #1455
- Fix overloads coming from overridable interfaces by @sylveon in #1458
- Make consume methods more amenable to optimization by @DefaultRyan in #1462
- Fix warnings in natvis project by @DefaultRyan in #1463
- Fix reading past end of array. by @dlech in #1468
- Fix setting of IntDir MSBuild property by @DefaultRyan in #1471
- Allow visualization of properties on generic types by @DefaultRyan in #1472
- Fix various build warnings by @DefaultRyan in #1473
- Configure guardian, SDL, TSA, and CodeQL in Official Builds by @DefaultRyan in #1474
- Clean up more warnings and Component Governance by @DefaultRyan in #1475
- Stop manually downloading hardcoded version of llvm/clang. by @DefaultRyan in #1478
- Enable prefast and warnings checker in SDL by @DefaultRyan in #1477
- Merge compiler and msbuild vpacks by @DefaultRyan in #1479
- Fix vpack clobbering and update to newer Windows container image by @DefaultRyan in #1480
New Contributors
- @Patschkowski made their first contribution in #1425
- @m417z made their first contribution in #1427
- @la-thorn made their first contribution in #1435
Full Changelog: 2.0.240405.15...2.0.250303.1
2.0.240405.15: Remove references to stale winmd files to fix incremental builds (#1404)
Changes:
- d2a6677 Remove references to stale winmd files to fix incremental builds (#1404)
- e03bdc4 Use latest upload/download actions (#1410)
- 17d095a Fix build following dependabot updates (#1409)
- 2b8fe6e Revert "Bump actions/upload-artifact from 3 to 4 (#1407)"
- ea18769 Bump actions/download-artifact from 3 to 4 (#1408)
- 6f74952 Bump actions/upload-artifact from 3 to 4 (#1407)
- 523eda7 Bump actions/stale from 6 to 9 (#1405)
- dfad7ed Bump actions/checkout from 3 to 4 (#1406)
- f0ce6c6 Create dependabot.yml
- adc6ef9 TDBuild - updating localized resource files.
See More
- bdf6dc4 Merlinbot baseline (#1401)
- 6dccf9e Pipeline changes to build, publish, and test (#1400)
- e69ff22 Remove dead code related to Windows 7 support (#1390)
- 91f485f Remove double forward (#1387)
- 2bfcd75 Fail gracefully when error reporting is suppressed (#1386)
This list of changes was auto generated.
2.0.240111.5: Update build.yml for Azure Pipelines (#1384)
Changes:
- 25a14f8 Update build.yml for Azure Pipelines (#1384) [ #1338 ]
- cb67472 CppWinRTAddXamlReferences to not use outputs as inputs (#1381)
- 5ef408f User/dmachaj/slim source location (#1379)
- 2511bf7 Update pool (#1374)
- fc587f3 Allow delegates to be created with weak reference + lambda (#1372) [ #1371 ]
- 912aa47 Update GitHub action LLVM version to 17.0.5 (#1373)
- bf4459b Allow resume_agile to be stored in a variable (#1358)
- fac72c8 Add
resume_agileto allow coroutine to resume in any apartment (#1356) - 23c4ced Improve GCC compatibility (#1352)
- 691f6f8 Support for std::span for winrt::array_view and winrt::com_array (#1343)
See More
- de6ca88 Remove old Windows 7 support code (#1348)
- 9b453cf Enable faster dev cycle in Visual Studio (#1340) [ #1341 ]
- 4196e08 Increase foldability of various templates (#1338)
- 0958cf3 Hide protected and overridable members from public projections (#1319)
- 953d65c Register event handlers with
shared_ptrandweak_ptr(#1330)
This list of changes was auto generated.
2.0.230706.1: Allow classic COM interfaces with get_self (#1314)
Changes:
- 297454e Allow classic COM interfaces with get_self (#1314) [ #1312 ]
- d3bb275 Fix source location test failure resulting from newer compiler (#1326)
- ec54c40 Clarify contributing guide (#1324)
- c24bc39 Fix workflow trigger (#1321)
- ed6a1e3 Update open source docs (#1315)
- e2dc214 Update readme
This list of changes was auto generated.
2.0.230524.4
2.0.230524.3
Changes:
- 4587264 Remove explicitly setting PreferredToolArchitecture, since VS 2022 handles this more comprehensively (#1304)
- 49b2cab Remove ARM OneBranch build workaround (#1303)
- 65581a3 Add
capturesupport for unconventional result types (#1301) - c3b7fcf Move official build pipelines to OneBranch (#1295)
- 6162c9d Fix flakey clock and line-number tests (#1294)
- a1b9593 Use safe DLL loading (avoid current directory) (#1293)
- 737adea Compliance and test cleanup (#1291)
- f3c7309 Expose configuring /nomidl. (#1290)
- 9e89b5c Create pipeline to sync mirror repo (#1286)
- 629f9e7 Update README.md
This list of changes was auto generated.
2.0.230225.1
What's Changed
- Stack usage reduction in apartment switching, and lifetime fixes by @oldnewthing in #1272
- Reduce stack consumption if unable to switch to apartment_context by @oldnewthing in #1276
- Fix unreliable clock epoch tests by @oldnewthing in #1277
- to_hstring for IStringable by @JaiganeshKumaran in #1271
- Add a clang-specific impl->projection conversion operator by @DHowett in #1274
New Contributors
Full Changelog: 2.0.230207.1...2.0.230225.1
2.0.230207.1
What's Changed
- Fix llvm-mingw tests with LLVM trunk by @alvinhochun in #1235
- cppwinrt: Support Linux cross-build with mingw-w64 by @alvinhochun in #1238
- CI: Refactor LLVM setup steps and use cache by @alvinhochun in #1242
- Add Linux native build by @alvinhochun in #1239
- Make compatible with GCC by @alvinhochun in #1245
- FIx build on macOS and add CI build by @alvinhochun in #1247
- Improve error reporting for clock test by @kennykerr in #1248
- Fix cancellation propagation by moving responsability to awaiter by @sylveon in #1246
- Try to fix random failure of the clock test by @alvinhochun in #1251
- Clarify object usage after move in make_delegate_with_shared_state by @yuvaln-s1 in #1253
- mingw: Stop using .weak symbols aliases by @alvinhochun in #1250
- cmake: Allow using external winmd headers to bypass download by @alvinhochun in #1256
- Make headers partially usable with LLVM/libc++ 13 by @alvinhochun in #1257
- Cleaning up some warnings for Clang and GCC by @alvinhochun in #1255
- Add option for using custom license text by @alvinhochun in #1262
- Add a mechanism to suppress std::source_location by @dmachaj in #1260
- tests: Fix and enable cpp20/custom_error for incoming LLVM 16 by @alvinhochun in #1265
- Move build pipeline into YAML by @DefaultRyan in #1268
- Make the formatter for IStringable const by @sylveon in #1270
- Workaround for false positive code analysis warning by @kennykerr in #1269
New Contributors
- @yuvaln-s1 made their first contribution in #1253
Full Changelog: 2.0.221121.5...2.0.230207.1
2.0.221121.5
What's Changed
- Enable more tests on llvm-mingw and some fixes by @alvinhochun in #1229
- Fix formatting primitive types such as integers by @sylveon in #1231
- Fix multi_threaded_map/_vector tests on Clang by @alvinhochun in #1230
- Some minor changes to CMakeLists.txt by @alvinhochun in #1233
- Fix null pointer dereference in weak_ref::get() by @alvinhochun in #1232
- Partial GCC compatibility improvements by @alvinhochun in #1234
Full Changelog: 2.0.221117.1...2.0.221121.5