Skip to content

Commit

Permalink
Drop [DynamicallyAccessedMembers] from Marshaler<T>.AbiType (#1461)
Browse files Browse the repository at this point in the history
* Drop [DAM] from Marshaler<T>.AbiType

* Update ApiCompatBaseline.txt
  • Loading branch information
Sergio0694 authored Jan 22, 2024
1 parent 329747f commit 53dcb5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/WinRT.Runtime/ApiCompatBaseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<K, V>.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<T>.AbiType' in the contract but not the implementation.
Total Issues: 12
19 changes: 9 additions & 10 deletions src/WinRT.Runtime/Marshalers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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<T, object> CreateMarshaler;
Expand Down

0 comments on commit 53dcb5d

Please sign in to comment.