This is a release with fixes for several reported issues in the October .NET SDK release which had the initial Windows SDK projections and source generator based on the CsWinRT 2.1.x release.
This release addresses one of the key feedbacks where the source generator was running in WPF / WinForms scenarios with respect to the entire app which wasn't needed given the primary API boundary in such apps isn't WinRT. Whereas in WinUI based apps, WinRT is a main ABI boundary and the source generator will continue to run. For WPF / WinForms apps which want to be trimming and AOT compatible with respect to the WinRT calls that they have, they can make use of the new attributes added to opt-in the source generator for those types. Note that these opt-in attributes can also be used in WinUI scenarios for scenarios that the source generator isn't detecting. Also note that if the change in source generation mode isn't desired for your project, the mode can be explicitly set using the CsWinRTAotOptimizerEanbled
property to go back to Auto
mode. More details on that and in general with these changes can be found here.
Even though this release is focused on fixes, due to the addition of new attributes to be used with the source generator, this is a minor version increment release. Also given the .NET 6 EOL, the new attributes are only added for .NET 8 and later.
C#/WinRT package:
https://www.nuget.org/packages/Microsoft.Windows.CsWinRT/2.2.0
.NET Windows SDK targeting packages for .NET 6:
<WindowsSdkPackageVersion>10.0.xxxxx.55</WindowsSdkPackageVersion>
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.26100.55
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.22621.55
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.22000.55
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.20348.55
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.19041.55
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.18362.55
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.17763.55
.NET Windows SDK targeting packages for .NET 8:
<WindowsSdkPackageVersion>10.0.xxxxx.56</WindowsSdkPackageVersion>
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.26100.56
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.22621.56
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.22000.56
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.20348.56
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.19041.56
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.18362.56
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.17763.56
.NET Windows SDK targeting packages for .NET 8 and UWP support:
<WindowsSdkPackageVersion>10.0.xxxxx.57</WindowsSdkPackageVersion>
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.26100.57
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.22621.57
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.22000.57
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.20348.57
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.19041.57
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.18362.57
https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref/10.0.17763.57
For more details on the CsWinRT 2.1.x release in general, see the CsWinRT 2.1.1 release notes.
What's Changed
- Fix enum attribute argument. by @dongle-the-gadget in #1827
- Improve exception messages for failed casts by @Sergio0694 in #1826
- Skip QI and 'IObjectReference' allocation in IDIC fallback by @Sergio0694 in #1833
- Add null checks to some 'Marshal.Release' calls by @Sergio0694 in #1832
- Fix types in attributes being projected as System.Type in WinMD. by @dongle-the-gadget in #1829
- Fix exception when using funcs and take another approach to escape assembly name by @manodasanW in #1836
- Fix 'CsWinRT1028' for generated 'EventSource' by @Sergio0694 in #1840
- Minor improvements to 'ExceptionHelpers.SetErrorInfo' by @Sergio0694 in #1824
- Updated issue templates with Issue Form by @0x5bfa in #1842
- Support explicitly implementing 'ICustomPropertyProvider' by @Sergio0694 in #1841
- Add 'CsWinRTDynamicallyInterfaceCastableExclusiveTo' by @Sergio0694 in #1835
- Add GC.KeepAlive when doing ABI call by @manodasanW in #1848
- Special case internal 'ReadOnlyList' type by @Sergio0694 in #1847
- Improve ICPP exception messages by @Sergio0694 in #1857
- Support [GeneratedBindableCustomProperty] on structs and records by @Sergio0694 in #1854
- Add OptIn mode for source generator by @manodasanW in #1861
- Bump Mono.Cecil to 0.11.6 by @Sergio0694 in #1862
- Fix exception propagation by @manodasanW in #1856
- Add 'WinRTManagedOnlyTypeDetails' type by @Sergio0694 in #1815
- Exclude System GuidAttribute from WinMD. by @dongle-the-gadget in #1855
- Replace null pointer function pointer call with helpful exception. by @manodasanW in #1866
- Fix scenario where source generator isn't detecting parameters passed to WinRT mapped interfaces by @manodasanW in #1867
New Contributors
Full Changelog: 2.1.6.241013.1...2.2.0.241111.1