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

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

Closed
jkoritzinsky opened this issue Sep 30, 2020 · 1 comment · Fixed by #42930
Closed
Assignees
Labels
area-Serialization blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' blocking-official-build blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs linkable-framework Issues associated with delivering a linker friendly framework untriaged New issue has not been triaged by the area owner

Comments

@jkoritzinsky
Copy link
Member

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

@jkoritzinsky jkoritzinsky added area-Serialization blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' blocking-official-build linkable-framework Issues associated with delivering a linker friendly framework blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs labels Sep 30, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Sep 30, 2020
@eerhardt
Copy link
Member

Looks like a cross between my change #42824 and @layomia's change #40691. I will fix it.

@eerhardt eerhardt self-assigned this Sep 30, 2020
eerhardt added a commit to eerhardt/runtime that referenced this issue Sep 30, 2020
Changes dotnet#40691 and dotnet#42824 conflicted. One added a new ILLink suppress warnings file, while the other added more warnings. This causes the build to break.

The fix is to regenerate the suppressions file with the latest code.

Fix dotnet#42926
eerhardt added a commit that referenced this issue Oct 1, 2020
Changes #40691 and #42824 conflicted. One added a new ILLink suppress warnings file, while the other added more warnings. This causes the build to break.

The fix is to regenerate the suppressions file with the latest code.

Fix #42926
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Serialization blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' blocking-official-build blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs linkable-framework Issues associated with delivering a linker friendly framework untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants