You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compilation error: ApiCompat shows Trim analysis error for IEnumerableConverterFactoryHelpers #42902
Building master currently is giving me a compilation error.
Steps to reproduce:
Check out master (bisect shows this was introduced in 994dca6)
Run ./build.sh -rc release -s clr+libs
Eventually, the ApiCompat step fails:
/code/personal/dotnet/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IEnumerableConverterFactoryHelpers.cs(179,17): Trim analysis error IL2075: System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryCreateRangeMethod(Type,Type,Type): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryConstructingType(Type)' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethods()'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [/code/personal/dotnet/runtime/src/libraries/src.proj]
and
code/personal/dotnet/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/IEnumerableConverterFactoryHelpers.cs(187,25): Trim analysis error IL2060: System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryCreateRangeMethod(Type,Type,Type): Call to System.Reflection.MethodInfo.MakeGenericMethod(Type[]) can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method. [/code/personal/dotnet/runtime/src/libraries/src.proj]
It isn't ApiCompat that fails here. It is the new ILLinkTrimSharedFramework linker analysis target introduced in #40691. Local output:
ApiCompat ->
D:\repos\dotnet_runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Converters\Collection\IEnumerableConverterFactoryHelpers.cs(179,17): Trim analysis error IL2075: System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryCreateRangeMethod(Type,Type,Type): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryConstructingType(Type)' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethods()'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\repos\dotnet_runtime\src\libraries\src.proj]
D:\repos\dotnet_runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Converters\Collection\IEnumerableConverterFactoryHelpers.cs(187,25): Trim analysis error IL2060: System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryCreateRangeMethod(Type,Type,Type): Call to `System.Reflection.MethodInfo.MakeGenericMethod(Type[])` can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method. [D:\repos\dotnet_runtime\src\libraries\src.proj]
externals ->
Microsoft.NETCore.Targets -> D:\repos\dotnet_runtime\artifacts\packages\Debug\Shipping\Microsoft.NETCore.Targets.6.0.0-dev.nupkg
Microsoft.NETCore.Platforms -> D:\repos\dotnet_runtime\artifacts\packages\Debug\Shipping\Microsoft.NETCore.Platforms.6.0.0-dev.nupkg
Microsoft.Extensions.Internal.Transport -> D:\repos\dotnet_runtime\artifacts\packages\Debug\NonShipping\Microsoft.Extensions.Internal.Transport.6.0.0-dev.nupkg
runincontext -> D:\repos\dotnet_runtime\artifacts\bin\coreclr\Windows_NT.x64.Release\runincontext.dll
ILCompiler.Reflection.ReadyToRun -> D:\repos\dotnet_runtime\artifacts\bin\coreclr\Windows_NT.x64.Release\ILCompiler.Reflection.ReadyToRun.dll
R2RTest -> D:\repos\dotnet_runtime\artifacts\bin\coreclr\Windows_NT.x64.Release\R2RTest\R2RTest.dll
R2RDump -> D:\repos\dotnet_runtime\artifacts\bin\coreclr\Windows_NT.x64.Release\R2RDump\R2RDump.dll
dotnet-pgo -> D:\repos\dotnet_runtime\artifacts\bin\coreclr\Windows_NT.x64.Release\dotnet-pgo\dotnet-pgo.dll
Build FAILED.
D:\repos\dotnet_runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Converters\Collection\IEnumerableConverterFactoryHelpers.cs(179,17): Trim analysis error IL2075: System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryCreateRangeMethod(Type,Type,Type): The requirements declared via the 'DynamicallyAccessedMembersAttribute' on the return value of method 'System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryConstructingType(Type)' don't match those on the implicit 'this' parameter of method 'System.Type.GetMethods()'. The source value must declare at least the same requirements as those declared on the target location it's assigned to [D:\repos\dotnet_runtime\src\libraries\src.proj]
D:\repos\dotnet_runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Converters\Collection\IEnumerableConverterFactoryHelpers.cs(187,25): Trim analysis error IL2060: System.Text.Json.Serialization.IEnumerableConverterFactoryHelpers.GetImmutableDictionaryCreateRangeMethod(Type,Type,Type): Call to `System.Reflection.MethodInfo.MakeGenericMethod(Type[])` can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method. [D:\repos\dotnet_runtime\src\libraries\src.proj]
0 Warning(s)
2 Error(s)
Time Elapsed 00:10:26.05
Build failed.
Some builds failed:
Configuration: Debug, Architecture: x64
I'll make a PR to add some extra logging to avoid this confusion in the future.
It looks like the warning suppressions (this, and this) for the GetImmutableDictionaryCreateRangeMethod method need to be updated following #42835 which added a Type parameter. Making a PR now.
Yes, it was a case of two PRs getting merged independently that caused the errors. The changes from the first PR #42835 (that cause linker warnings when not suppressed) were not picked up by the CI system in the second PR #40691 (which makes such warnings visible).
Activity
layomia commentedon Sep 30, 2020
It isn't
ApiCompatthat fails here. It is the newILLinkTrimSharedFrameworklinker analysis target introduced in #40691. Local output:I'll make a PR to add some extra logging to avoid this confusion in the future.
It looks like the warning suppressions (this, and this) for the
GetImmutableDictionaryCreateRangeMethodmethod need to be updated following #42835 which added aTypeparameter. Making a PR now.vcsjones commentedon Sep 30, 2020
Ah, my apologies, I read the build output wrong.
stephentoub commentedon Sep 30, 2020
How did this get merged when it breaks CI? Was it a case of two PRs getting merged independently/concurrently that together resulted in errors?
layomia commentedon Sep 30, 2020
Yes, it was a case of two PRs getting merged independently that caused the errors. The changes from the first PR #42835 (that cause linker warnings when not suppressed) were not picked up by the CI system in the second PR #40691 (which makes such warnings visible).