Skip to content

Conversation

@kythant
Copy link

@kythant kythant commented Nov 25, 2025

No description provided.

@kythant kythant closed this Nov 25, 2025
@kythant kythant reopened this Nov 26, 2025
@kythant kythant closed this Nov 27, 2025
@kythant kythant reopened this Dec 1, 2025
kythant and others added 17 commits December 1, 2025 15:59
Simplifies and clarifies the handling of TypeReference creation, including improved comments and restructuring for primitive and proxy types. Ensures more consistent reporting of TypeKind and streamlines marshalling info usage.
Changed the TypeReference.Name field from string? to ReadOnlySpan<char> for improved memory safety and performance. Updated marshalling logic and related references to accommodate the new type.
Added [WindowsRuntimeMetadata] attributes to ABI type classes in WinRT.Runtime2 to specify their associated Windows contracts. This improves metadata clarity and contract mapping for types such as Boolean, Byte, Char, DateTimeOffset, Double, EventHandler, Exception, Guid, Int16, Int32, Int64, Numerics types, Object, Single, String, TimeSpan, Type, UInt16, UInt32, UInt64, and Uri.
Introduces TypeMapAssociation attributes for DynamicInterfaceCastableImplementationTypeMapGroup to INotifyDataErrorInfo, IDisposable, and IServiceProvider ABI interfaces. Also adds WindowsRuntimeMetadata and WindowsRuntimeClassName attributes to their respective interface implementations for improved WinRT interop.
Added logic to TypeMarshaller to support round-tripping C# primitive types (e.g., System.SByte) that are not Windows Runtime types. This ensures such types can be resolved even if not found in the WindowsRuntimeMarshallingInfo lookup.
kythant and others added 25 commits February 2, 2026 12:16
Add assembly-level TypeMapAssociation attributes to associate INotifyPropertyChanged and INotifyCollectionChanged with their respective ABI proxy implementation types (INotifyPropertyChangedInterfaceImpl and INotifyCollectionChangedInterfaceImpl). This enables the DynamicInterfaceCastableImplementationTypeMapGroup to locate the proxy types for interop/ComWrappers scenarios. Changes applied to the corresponding ABI files for ComponentModel and Collections.Specialized.
Replace fully-qualified "global::System.Collections.IEnumerator" with the simpler "IEnumerator" in IEnumerable-related marshaller and implementation methods (GetEnumerator implementations and return types) in src/WinRT.Runtime2/ABI/System/Collections/IEnumerable.cs for consistency and readability. No behavioral changes intended.
Add InterfaceType calls to emit dynamic custom mapped type map entries for INotifyPropertyChanged and INotifyCollectionChanged. Each entry supplies Windows and Microsoft XAML metadata, the trim target (using the respective reference type signature), interopReferences, module, and useWindowsUIXamlProjections. Keeps TODO notes to also emit the IDIC interface.
Make the WindowsRuntimeComWrappersMarshaller attribute optional when generating interop proxy types. Add a new useComWrappersMarshallerAttribute flag to InterfaceType call sites and its signature; only look up and pass the marshaller attribute TypeDefinition when requested. Update InteropTypeDefinitionBuilder to accept a nullable attribute type and only emit the custom attribute if it's non-null. This avoids unnecessary lookups/emission for interfaces that don't require a ComWrappers marshaller (e.g. INotifyPropertyChanged) while still enabling it for types that do (e.g. IEnumerable). Files changed: DynamicCustomMappedTypeMapEntriesBuilder.cs, InteropTypeDefinitionBuilder.cs.
Add the [WindowsRuntimeClassName("Microsoft.UI.Xaml.Data.DataErrorsChangedEventArgs")] attribute to the ABI.System.ComponentModel.DataErrorsChangedEventArgs declaration so the ABI type is associated with the correct WinRT class name. This clarifies runtime metadata for WinRT interop and mapping to Microsoft.UI.Xaml.Data.DataErrorsChangedEventArgs.
Remove the [WindowsRuntimeMappedMetadata("Windows.Foundation.FoundationContract")] attribute from ABI.System.EventHandler and add a clarifying comment. This prevents automatic Windows Runtime mapping for EventHandler so that marshalling typeof(EventHandler) remains a custom type and aligns with existing special-case marshalling behavior.
Remove the WindowsRuntimeMappedMetadata and WindowsRuntimeClassName attributes from the DynamicInterfaceCastable implementation of global::System.IDisposable (IDisposableInterfaceImpl in ABI/System/IDisposable.cs). This change strips unnecessary WinRT annotations from the interface implementation; no other code modifications were made.
}

void write_struct_winrt_classname_attribute(writer& w, TypeDef const& type)
void write_winrt_classname_attribute(writer& w, TypeDef const& type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void write_winrt_classname_attribute(writer& w, TypeDef const& type)
void write_value_type_winrt_classname_attribute(writer& w, TypeDef const& type)

@Sergio0694 Sergio0694 force-pushed the user/kythant/TypeHandling branch from 550bc58 to 5b9ef4e Compare February 4, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants