-
Notifications
You must be signed in to change notification settings - Fork 121
Minor fixes to custom-mapped types in 'cswinrtgen' #2155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging/3.0
Are you sure you want to change the base?
Conversation
Replaces the use of _corLibTypeFactory.CorLibScope with SystemObjectModel for creating the TypeReference for System.Windows.Input.ICommand. This change may improve consistency or correctness in type reference creation.
Added support for mapping the IVectorChangedEventArgs interface to its well-known IID string in WellKnownInterfaceIIDs. This improves interface recognition for Windows.Foundation.Collections.IVectorChangedEventArgs.
Relocated the IID mappings for IDisposable and IServiceProvider to an earlier position in the switch statement within WellKnownInterfaceIIDs.cs. This change ensures these interfaces are matched before others, likely to address precedence or matching issues.
Updated GuidGenerator and WellKnownInterfaceIIDs to support resolving interface IIDs based on the useWindowsUIXamlProjections flag. This enables correct GUID selection for interfaces that differ between Windows.UI.Xaml and Microsoft.UI.Xaml projections, improving compatibility and correctness in generated interop signatures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses issues with custom-mapped type handling in the 'cswinrtgen' code generator. The main changes correct the scope for ICommand, add missing Interface IDs (IIDs) for several custom-mapped types, and ensure proper handling of Windows UI XAML (WUX) and Microsoft UI XAML (MUX) type projections.
Key changes:
- Fixed
ICommandtype reference to use the correctSystemObjectModelscope instead ofCorLibScope - Added missing IID entries and GUID mappings for
IVectorChangedEventArgs,INotifyCollectionChanged,INotifyPropertyChanged,ICommand,INotifyDataErrorInfo, andIServiceProvider - Updated method signatures to include
useWindowsUIXamlProjectionsparameter throughout the codebase for consistent XAML projection handling
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/WinRT.Interop.Generator/References/WellKnownInterfaceIIDs.cs | Reorganized IID mappings, added missing GUIDs for XAML types, and updated documentation to reference manually projected types |
| src/WinRT.Interop.Generator/References/InteropReferences.cs | Fixed ICommand type reference to use SystemObjectModel scope instead of incorrect CorLibScope |
| src/WinRT.Interop.Generator/Helpers/SignatureGenerator.Projections.cs | Updated all calls to TryGetIIDFromWellKnownInterfaceIIDsOrAttribute and TryGetGUID to pass useWindowsUIXamlProjections parameter |
| src/WinRT.Interop.Generator/Helpers/GuidGenerator.cs | Added useWindowsUIXamlProjections parameter to TryGetIIDFromWellKnownInterfaceIIDsOrAttribute method signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Added [Guid] attributes to several Windows.Foundation and Windows.Foundation.Collections interface definitions to specify their interface IDs. This change improves COM interop and aligns the interfaces with their corresponding WinRT specifications.
Extended the type comparison logic to include IEnumerable, IEnumerator, and IList interfaces in WindowsRuntimeExtensions. This ensures these interfaces are now considered in relevant type checks.
Added mappings from System.Collections.IEnumerator to Microsoft.UI.Xaml.Interop.IBindableIterator and from Microsoft.UI.Xaml.Interop.IBindableIterator to Windows.UI.Xaml.Interop.IBindableIterator. This improves type translation support for collection interfaces.
Added mappings for IBindableIterable, IBindableIterator, and IBindableVector interfaces for both Windows.UI.Xaml and Microsoft.UI.Xaml projections. Moved the corresponding GUID assignments for IEnumerable, IEnumerator, and IList to the XAML section to ensure correct interface resolution.
This PR fixes some issues around custom-mapped types in 'cswinrtgen':
ICommandwas from the wrong scope[Guid]attributes on some custom-mapped/manual interfaces.