Skip to content
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

Drop [DynamicallyAccessedMembers] from Marshaler<T>.AbiType #1461

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading