microsoft / kiota-abstractions-dotnet

Abstractions library for the Kiota generated SDKs in dotnet
https://aka.ms/kiota/docs
MIT License
24 stars 21 forks source link

IParseNode enum methods should be marked DynamicallyAccessedMemberTypes.PublicFields #201

Closed hwoodiwiss closed 4 months ago

hwoodiwiss commented 4 months ago

Currently GetCollectionOfEnumValues and GetEnumValue are marked DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All). This causes IL3050 to be emitted by ILC at the moment, as All indicates that Enum.GetValues(Type) could be called dynamically.

Given current usage in the serialization libraries, PublicFields or PublicFields | NonPublicFields should be sufficient, and will prevent this warning.

This was indicated to me in https://github.com/dotnet/runtime/issues/98864, as I had originally thought this was a false positive.