From 43200a8d267a8a83927bdf03adb0d18936d2ab1e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 22 Jan 2024 11:34:11 +0100 Subject: [PATCH 1/2] Drop [DAM] from Marshaler.AbiType --- src/WinRT.Runtime/Marshalers.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/WinRT.Runtime/Marshalers.cs b/src/WinRT.Runtime/Marshalers.cs index 3954d4fb6..278d0e576 100644 --- a/src/WinRT.Runtime/Marshalers.cs +++ b/src/WinRT.Runtime/Marshalers.cs @@ -1811,14 +1811,16 @@ static Marshaler() } else { - AbiType = typeof(T).FindHelperType(); - if (AbiType != null) + Type abiType = typeof(T).FindHelperType(); + + // Could still be blittable and the 'ABI.*' type exists for other reasons (e.g. it's a mapped type) + if (abiType?.GetMethod("FromAbi", BindingFlags.Public | BindingFlags.Static) is null) { - // Could still be blittable and the 'ABI.*' type exists for other reasons (e.g. it's a mapped type) - if (AbiType.GetMethod("FromAbi", BindingFlags.Public | BindingFlags.Static) == null) - { - AbiType = null; - } + AbiType = null; + } + else + { + AbiType = abiType; } } @@ -1964,9 +1966,6 @@ static Marshaler() RefAbiType = AbiType.MakeByRefType(); } -#if NET - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] -#endif public static readonly Type AbiType; public static readonly Type RefAbiType; public static readonly Func CreateMarshaler; From 2699f98267a5bfc4dd3331c8cc948992f7f52226 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 22 Jan 2024 12:30:56 +0100 Subject: [PATCH 2/2] Update ApiCompatBaseline.txt --- src/WinRT.Runtime/ApiCompatBaseline.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WinRT.Runtime/ApiCompatBaseline.txt b/src/WinRT.Runtime/ApiCompatBaseline.txt index ae2379fb0..8efb814c8 100644 --- a/src/WinRT.Runtime/ApiCompatBaseline.txt +++ b/src/WinRT.Runtime/ApiCompatBaseline.txt @@ -10,4 +10,5 @@ MembersMustExist : Member 'public System.Delegate System.Delegate ABI.System.Col MembersMustExist : Member 'public System.Delegate System.Delegate ABI.System.Collections.Generic.KeyValuePair.Vftbl.get_Value_1' does not exist in the implementation but it does exist in the contract. TypesMustExist : Type 'ABI.System.Collections.Specialized.INotifyCollectionChanged' does not exist in the implementation but it does exist in the contract. TypesMustExist : Type 'ABI.System.ComponentModel.INotifyDataErrorInfo' does not exist in the implementation but it does exist in the contract. -Total Issues: 11 +CannotRemoveAttribute : Attribute 'System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute' exists on 'System.Type WinRT.Marshaler.AbiType' in the contract but not the implementation. +Total Issues: 12