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.
Currently
GetCollectionOfEnumValues
andGetEnumValue
are markedDynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)
. This causes IL3050 to be emitted by ILC at the moment, asAll
indicates thatEnum.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.