diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1eed349b060dd..d798b884594ef 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -230,9 +230,9 @@ https://github.com/dotnet/runtime 7698a9a80c5f6270aa1122d79ce419c7b03f2498 - + https://github.com/dotnet/linker - 5baeb5e08b4a5fd6995e6247c7cb41b673c5ecdc + 5929598c16cd5d791eb33d4b5978f3140a136262 https://github.com/dotnet/xharness diff --git a/eng/Versions.props b/eng/Versions.props index bdeb8db1a137c..6ce6adf34b430 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -169,7 +169,7 @@ 6.0.0-preview-20220104.1 - 7.0.100-1.22160.1 + 7.0.100-1.22168.6 $(MicrosoftNETILLinkTasksVersion) 7.0.0-preview.3.22157.1 diff --git a/src/libraries/System.Private.CoreLib/src/System/Type.Helpers.cs b/src/libraries/System.Private.CoreLib/src/System/Type.Helpers.cs index 71cb7b5e75606..966818949dc25 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Type.Helpers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Type.Helpers.cs @@ -366,10 +366,16 @@ public virtual bool IsAssignableFrom([NotNullWhen(true)] Type? c) return false; } + // IL2085 is produced due to the "this" of the method not being annotated and used in effectively this.GetInterfaces() [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2085:UnrecognizedReflectionPattern", Justification = "The GetInterfaces technically requires all interfaces to be preserved" + "But this method only compares the result against the passed in ifaceType." + "So if ifaceType exists, then trimming should have kept it implemented on any type.")] + // IL2075 is produced due to the BaseType not returning annotated value and used in effectively this.BaseType.GetInterfaces() + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2075:UnrecognizedReflectionPattern", + Justification = "The GetInterfaces technically requires all interfaces to be preserved" + + "But this method only compares the result against the passed in ifaceType." + + "So if ifaceType exists, then trimming should have kept it implemented on any type.")] internal bool ImplementInterface(Type ifaceType) { Type? t = this; diff --git a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs index cdee0af270ac9..9e7a3d9ffcd3c 100644 --- a/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs +++ b/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonFormatWriterGenerator.cs @@ -728,6 +728,7 @@ private void InternalSerialize(MethodInfo methodInfo, LocalBuilder memberValue, _ilg.Call(methodInfo); } + [RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)] private LocalBuilder UnwrapNullableObject(LocalBuilder memberValue)// Leaves !HasValue on stack { Type memberType = memberValue.LocalType; diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Types.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Types.cs index ee804a5bfd4a0..1e56793922b95 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Types.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/Types.cs @@ -1196,12 +1196,13 @@ private static void PopulateMemberInfos(StructMapping structMapping, MemberMappi } } + // The DynamicallyAccessedMemberTypes.All annotation is required here because the method + // tries to access private members on base types (which is normally blocked by reflection) + // This doesn't make the requirements worse since the only callers already have the type + // annotated as All anyway. private static bool ShouldBeReplaced( MemberInfo memberInfoToBeReplaced, - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties - | DynamicallyAccessedMemberTypes.NonPublicProperties - | DynamicallyAccessedMemberTypes.PublicFields - | DynamicallyAccessedMemberTypes.NonPublicFields)] Type derivedType, + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type derivedType, out MemberInfo replacedInfo) { replacedInfo = memberInfoToBeReplaced;