Граф коммитов

25 Коммитов

Автор SHA1 Сообщение Дата
David Machaj 2aed347fb7
GitHub Actions workflow cannot build arm32 after updating Windows SDK (#1454)
arm32 is not supported anymore by Windows. There has not been a native arm32 OS since before Win11. The wow32 backcompat on arm64 devices to run arm32 programs was removed with Win11 24H2. Most notably, the ability to build arm32 with newer SDKs and toolsets has seemingly been removed. This is now breaking the CI build.

The easiest fix is to simply remove arm32 support.
2024-11-18 16:52:31 -08:00
David Machaj b82340f3fc
Bug: Projected winrt::consume_ methods will nullptr crash if the underlying QueryInterface call fails (#1442)
# Why is this change being made?
The generated projection code for interfaces that the metadata declares as required for a runtimeclass assume that QueryInterface never fails. Assuming the metadata is correct in the first place, this is a valid assumption for inproc calls.

However, for cross-process calls the QI can fail even if the metadata is correct and the class really does implement all of the required interfaces. It can fail with E_ACCESSDENIED and a variety of other RPC error codes.

When this happens there is a nullptr crash in the generated consume method. This can be very painful to debug because the HRESULT is lost by the time it crashes.

# Briefly summarize what changed
This set of changes fixes the crash by detecting the QueryInterface error and throwing an exception when that occurs during one of these required casts. The try_as method was changed to capture COM error context when the QI fails. The code gen surrounding WINRT_IMPL_STUB was changed to save the result into a temporary variable and then pass it to a new check_cast_result method. check_cast_result is marked noinline so that the binary size impact of throwing exceptions is limited to a single function instead of inlining into high-volume generated code.

If the cast succeeded then nothing happens. If the cast failed, returning null, then the stored COM exception is retrieved. Assuming it is available the HRESULT is pulled out of it and it is thrown. This then propagates like any other exception. Callers are free to try and catch it or let it go uncaught and crash. Now they have the choice.

I also added a new file of test code that exercises this code path. The test_component IDL declares a runtimeclass that implements IStringable. And then the implementation fails to implement IStringable. When ToString is called on this object it hits the failure path. The cppwinrt code gen will not allow this to happen so I had to directly use winrt::implements.

# How was this change tested?
Besides the new test cases I also wrote a little console app that crashes this way. I built and ran it using the latest stable cppwinrt as well as my private new one. As expected the debugger blame is far more useful with these changes.
2024-10-30 09:54:35 -07:00
Jon Wiswall 9b453cfc51
Enable faster dev cycle in Visual Studio (#1340)
* Enable faster dev cycle in Visual Studio

* Oops, remove one more run

* Fix linux build temporarily - see also #1341

---------

Co-authored-by: Jon Wiswall <jonwis@ntdev.microsoft.com>
2023-08-17 15:51:08 -07:00
alvinhochun 1b4e0099cc
CI: Build ARM64 cppwinrt and tests (not run) (#1211) 2022-10-20 10:42:42 -05:00
Raymond Chen 4f0be70254
Static events should not use the auto trick (#1158)
The same way we don't use the auto trick for static properties
and static methods.
2022-06-08 15:05:47 -07:00
Scott Jones f992bc4e4f
catch is evidently incompatible with VS 2022 (platform toolset v143) - backing off to unblock (#1127)
* catch is evidently incompatible with VS 2022 (platform toolset v143) - backing off to unblock

* unlikely to be needed, but reordered to support other platform toolset overriding

* pipeline now running out of disk space - clean intermediates as we go

* standardize OutDir, IntDir. ensure they are different for visualizer.
2022-03-23 15:35:56 -07:00
Scott Jones 768139a943
Several nuget tests failing to build with VS2022. Standardize on directory.build.props to use PlatformToolset v143 (#1125) 2022-03-22 15:14:59 -07:00
Kenny Kerr b4015649c5
Add type support for `Windows.Foundation.Numerics.Rational` (#1106) 2022-02-22 12:58:33 -08:00
Kenny Kerr e1920949fd
Allow non-void static setter methods when compiling with `-opt` (#1063) 2021-11-19 14:37:46 -08:00
Ben Kuhn bddd2e1303
Improved struct ordering (#1052) 2021-10-28 15:42:43 -07:00
Kenny Kerr 24af032f48
Support binding std::optional<T> implementation to IReference<T> parameters (#1030) 2021-09-30 12:53:58 -07:00
Kenny Kerr 8f40198d62
Fix edge case in nested Windows namespace (#1004) 2021-08-25 09:16:01 -07:00
Kenny Kerr 122b732393
Windows test (#905) 2021-03-26 13:59:04 -07:00
Kenny Kerr 1935608ceb
Support nested Windows namespace (#904) 2021-03-26 11:56:02 -07:00
Raymond Chen 84d2814bc5
Add ODR detection to WINRT_NO_MAKE_DETECTION (#735) 2020-09-01 12:15:23 -07:00
Raymond Chen e347c6099b
Do not pass nullptr arrays to the ABI (#541) 2020-02-27 18:27:14 -08:00
Kenny Kerr f092626a71
Fix support for delegates returning arrays of structs (#510) 2020-01-31 11:33:22 -08:00
Kenny Kerr 27435d63f2 Revert "Revert "Build tweaks to simplify Win7 smoke testing (#471)""
This reverts commit 5579f5d605.
2020-01-15 08:35:21 -08:00
Kenny Kerr 5579f5d605 Revert "Build tweaks to simplify Win7 smoke testing (#471)"
This reverts commit 0651af8a48.
2020-01-15 08:20:01 -08:00
Kenny Kerr 0651af8a48
Build tweaks to simplify Win7 smoke testing (#471) 2020-01-14 17:02:45 -08:00
Kenny Kerr a2c65b43e0
Support for Windows 7 (#469) 2020-01-14 11:13:12 -08:00
Kenny Kerr fa72f7911e build 2019-10-17 09:47:44 -07:00
Kenny Kerr 60034f1d97 generated 2019-10-11 10:21:08 -07:00
Raymond Chen 5b948a9230 Fix implementation of static events
Return value for static events was declared as event_token
in the header (when built as a component), but as auto in
the implementation.

Align implementation with header.
2019-10-10 12:59:15 -07:00
Kenny Kerr f088d90071 port 2019-10-08 08:19:10 -07:00