Skip to content

IL Link warning failures in System.Private.DataContractSerialization breaking the build #42926

@jkoritzinsky

Description

@jkoritzinsky

I'm seeing a variety of trim analysis warnings causing build failures in master and locally due to #42824

Here's some of the warnings I've seen:

D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\ClassDataContract.cs(390,17): Trim analysis error IL2070: System.Runtime.Serialization.ClassDataContract.IsNonAttributedTypeValidForSerialization(Type): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the parameter 'type' of method 'System.Runtime.Serialization.ClassDataContract.IsNonAttributedTypeValidForSerialization(Type)' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\ClassDataContract.cs(1428,17): Trim analysis error IL2075: System.Runtime.Serialization.ClassDataContract.ClassDataContractCriticalHelper.GetNonAttributedTypeConstructor(): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.DataContract.DataContractCriticalHelper.get_UnderlyingType()' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\DataContract.cs(1981,29): Trim analysis error IL2070: System.Runtime.Serialization.DataContract.ImportKnownTypeAttributes(Type,Dictionary<Type,Type>,Dictionary2&): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the parameter 'type' of method 'System.Runtime.Serialization.DataContract.ImportKnownTypeAttributes(Type,Dictionary<Type,Type>,Dictionary2&)' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethod(String,BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\XmlDataContract.cs(288,25): Trim analysis error IL2075: System.Runtime.Serialization.XmlDataContract.GenerateCreateXmlSerializableDelegate(): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Reflection.Assembly.GetType(String)' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethod(String,BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\XmlDataContract.cs(295,25): Trim analysis error IL2075: System.Runtime.Serialization.XmlDataContract.GenerateCreateXmlSerializableDelegate(): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.DataContract.get_UnderlyingType()' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs(576,29): Trim analysis error IL2075: System.D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs(576,29): Trim analysis error IL2075: System.D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs(576,29): Trim analysis error IL2075: System.D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs(576,29): Trim analysis error IL2075: System.D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs(576,29): Trim analysis error IL2075: System.D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs(576,29): Trim analysis error IL2075: System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadCollection(CollectionDataContract): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.DataContract.get_UnderlyingType()' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs(580,29): Trim analysis error IL2075: System.Runtime.Serialization.Json.JsonFormatReaderGenerator.CriticalHelper.ReadCollection(CollectionDataContract): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.DataContract.get_UnderlyingType()' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\XmlDataContract.cs(244,13): Trim analysis error IL2075: System.Runtime.Serialization.XmlDataContract.GetConstructor(): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.DataContract.get_UnderlyingType()' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\CollectionDataContract.cs(886,17): Trim analysis error IL2075: System.Runtime.Serialization.CollectionDataContract.CollectionDataContractCriticalHelper.GetCollectionElementType(): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.Globals.get_TypeOfGenericDictionaryEnumerator()' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethod(String,BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\XmlFormatReaderGenerator.cs(599,29): Trim analysis error IL2075: System.Runtime.Serialization.XmlFormatReaderGenerator.CriticalHelper.ReadCollection(CollectionDataContract): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.DataContract.get_UnderlyingType()' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\XmlFormatWriterGenerator.cs(412,21): Trim analysis error IL2075: System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.WriteCollection(CollectionDataContract): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.Globals.get_TypeOfGenericDictionaryEnumerator()' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethod(String,BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\XmlFormatWriterGenerator.cs(413,21): Trim analysis error IL2075: System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.WriteCollection(CollectionDataContract): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.Globals.get_TypeOfGenericDictionaryEnumerator()' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethod(String,BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\XmlFormatWriterGenerator.cs(460,25): Trim analysis error IL2075: System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.WriteCollection(CollectionDataContract): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.Globals.get_TypeOfGenericDictionaryEnumerator()' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\XmlFormatGeneratorStatics.cs(211,21): Trim analysis error IL2075: System.Runtime.Serialization.XmlFormatGeneratorStatics.get_HashtableCtor(): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.Globals.get_TypeOfHashtable()' don't match those on the implicit 'this' parameter of method 'System.Type.GetConstructor(BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj] D:\source\runtime\src\libraries\System.Private.DataContractSerialization\src\System\Runtime\Serialization\DataContract.cs(1128,25): Trim analysis error IL2075: System.Runtime.Serialization.DataContract.DataContractCriticalHelper.get_ParseMethod(): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Runtime.Serialization.DataContract.DataContractCriticalHelper.get_UnderlyingType()' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethod(String,BindingFlags,Binder,Type[],ParameterModifier[])'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\source\runtime\src\libraries\src.proj]

cc: @eerhardt

Metadata

Metadata

Assignees

Labels

area-Serializationblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'blocking-official-buildblocking-outerloopBlocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runslinkable-frameworkIssues associated with delivering a linker friendly frameworkuntriagedNew issue has not been triaged by the area owner

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions