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

Cannot build runtime on s390x: The "ApiCompatTask" task failed unexpectedly. #68266

Closed
iii-i opened this issue Apr 20, 2022 · 12 comments
Closed
Labels
arch-s390x Related to s390x architecture (unsupported) area-AssemblyLoader-mono needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Milestone

Comments

@iii-i
Copy link
Contributor

iii-i commented Apr 20, 2022

Description

For some weeks it's no longer possible to build the master branch on s390x due to an ApiCompatTask failure.
It seems that this task depends on some DLLs (e.g. Microsoft.Cci.dll) that cannot be loaded on s390x.

Reproduction Steps

On an s390x machine:

  • Install dotnet sdk 6.0.
  • Run ./build.sh

Expected behavior

The build succeeds.

Actual behavior

The build fails with:

/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018: The "ApiCompatTask" task failed unexpectedly. [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018: System.TypeLoadException: Could not load type System.Collections.Generic.IEqualityComparer`1[[Microsoft.Cci.ITypeReference, Microsoft.Cci, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a while decoding custom attribute: (null) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributesBase(ICustomAttributeProvider obj, Type attributeType, Boolean inheritedOnly) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributes(ICustomAttributeProvider obj, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttributeExtensions.GetCustomAttributes(MemberInfo element, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Util.DirectAttributeContext.GetCustomAttributes(Type reflectedType, MemberInfo member) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.Convention.AttributedModelProviderExtensions.GetDeclaredAttributes[ExportAttribute](AttributedModelProvider convention, Type reflectedType, MemberInfo member) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.<DiscoverPropertyExports>d__17.MoveNext() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.<DiscoverExports>d__0.MoveNext() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart(TypeInfo type, DiscoveredPart& part) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor(IEnumerable`1 types, AttributedModelProvider attributeContext) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.Hosting.ContainerConfiguration.CreateContainer() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.GetCompositionHost() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.GetDifferenceWriter(TextWriter writer, IDifferenceFilter filter, Boolean enforceOptionalRules, Boolean mdil, Boolean excludeNonBrowsable, Boolean includeInternals, Boolean excludeCompilerGenerated, String remapFile, Boolean groupByAssembly, String leftOperand, String rightOperand, IEnumerable`1 excludeAttributes, Boolean allowDefaultInterfaceMethods, Boolean usesMSBuildLog) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.Run(Boolean usesMSBuildLog, Boolean disableAssemblyResolveTraceListener, IEnumerable`1 contracts, IEnumerable`1 implementationDirectories, TextWriter output, String rightOperand, String leftOperand, Boolean listRules, IEnumerable`1 baselineFileNames, Boolean validateBaseline, Boolean resolveFramework, Boolean skipUnifyToLibPath, IEnumerable`1 contractDependsFileNames, String contractCoreAssembly, Boolean ignoreDesignTimeFacades, Boolean warnOnMissingAssemblies, Boolean respectInternals, Boolean warnOnIncorrectVersion, Boolean enforceOptionalRules, Boolean mdil, Boolean excludeNonBrowsable, Boolean excludeCompilerGenerated, String remapFile, Boolean skipGroupByAssembly, IEnumerable`1 excludeAttributes, Boolean allowDefaultInterfaceMethods) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.ApiCompatTask.Execute() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]

Regression?

Yes. Started with 2575ce5.

Known Workarounds

Cross-building from x86_64 still works.

Configuration

# uname -a
Linux dotnet-s390x 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:09:01 UTC 2022 s390x s390x s390x GNU/Linux

# dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         linux-s390x
 Base Path:   /root/dotnet-sdk-6.0.100-linux-s390x/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  N/A

.NET SDKs installed:
  6.0.100 [/root/dotnet-sdk-6.0.100-linux-s390x/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/root/dotnet-sdk-6.0.100-linux-s390x/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/root/dotnet-sdk-6.0.100-linux-s390x/shared/Microsoft.NETCore.App]

Other information

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Drawing untriaged New issue has not been triaged by the area owner labels Apr 20, 2022
@ghost
Copy link

ghost commented Apr 20, 2022

Tagging subscribers to this area: @dotnet/area-system-drawing
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

For some weeks it's no longer possible to build the master branch on s390x due to an ApiCompatTask failure.
It seems that this task depends on some DLLs (e.g. Microsoft.Cci.dll) that cannot be loaded on s390x.

Reproduction Steps

On an s390x machine:

  • Install dotnet sdk 6.0.
  • Run ./build.sh

Expected behavior

The build succeeds.

Actual behavior

The build fails with:

/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018: The "ApiCompatTask" task failed unexpectedly. [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018: System.TypeLoadException: Could not load type System.Collections.Generic.IEqualityComparer`1[[Microsoft.Cci.ITypeReference, Microsoft.Cci, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a while decoding custom attribute: (null) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributesBase(ICustomAttributeProvider obj, Type attributeType, Boolean inheritedOnly) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributes(ICustomAttributeProvider obj, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttributeExtensions.GetCustomAttributes(MemberInfo element, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Util.DirectAttributeContext.GetCustomAttributes(Type reflectedType, MemberInfo member) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.Convention.AttributedModelProviderExtensions.GetDeclaredAttributes[ExportAttribute](AttributedModelProvider convention, Type reflectedType, MemberInfo member) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.<DiscoverPropertyExports>d__17.MoveNext() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.<DiscoverExports>d__0.MoveNext() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart(TypeInfo type, DiscoveredPart& part) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor(IEnumerable`1 types, AttributedModelProvider attributeContext) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.Hosting.ContainerConfiguration.CreateContainer() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.GetCompositionHost() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.GetDifferenceWriter(TextWriter writer, IDifferenceFilter filter, Boolean enforceOptionalRules, Boolean mdil, Boolean excludeNonBrowsable, Boolean includeInternals, Boolean excludeCompilerGenerated, String remapFile, Boolean groupByAssembly, String leftOperand, String rightOperand, IEnumerable`1 excludeAttributes, Boolean allowDefaultInterfaceMethods, Boolean usesMSBuildLog) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.Run(Boolean usesMSBuildLog, Boolean disableAssemblyResolveTraceListener, IEnumerable`1 contracts, IEnumerable`1 implementationDirectories, TextWriter output, String rightOperand, String leftOperand, Boolean listRules, IEnumerable`1 baselineFileNames, Boolean validateBaseline, Boolean resolveFramework, Boolean skipUnifyToLibPath, IEnumerable`1 contractDependsFileNames, String contractCoreAssembly, Boolean ignoreDesignTimeFacades, Boolean warnOnMissingAssemblies, Boolean respectInternals, Boolean warnOnIncorrectVersion, Boolean enforceOptionalRules, Boolean mdil, Boolean excludeNonBrowsable, Boolean excludeCompilerGenerated, String remapFile, Boolean skipGroupByAssembly, IEnumerable`1 excludeAttributes, Boolean allowDefaultInterfaceMethods) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.ApiCompatTask.Execute() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]

Regression?

Yes. Started with 2575ce5.

Known Workarounds

Cross-building from x86_64 still works.

Configuration

# uname -a
Linux dotnet-s390x 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:09:01 UTC 2022 s390x s390x s390x GNU/Linux

# dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         linux-s390x
 Base Path:   /root/dotnet-sdk-6.0.100-linux-s390x/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  N/A

.NET SDKs installed:
  6.0.100 [/root/dotnet-sdk-6.0.100-linux-s390x/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/root/dotnet-sdk-6.0.100-linux-s390x/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/root/dotnet-sdk-6.0.100-linux-s390x/shared/Microsoft.NETCore.App]

Other information

No response

Author: iii-i
Assignees: -
Labels:

area-System.Drawing, untriaged

Milestone: -

@uweigand
Copy link
Contributor

CC @ViktorHofer

@ghost
Copy link

ghost commented Apr 20, 2022

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

For some weeks it's no longer possible to build the master branch on s390x due to an ApiCompatTask failure.
It seems that this task depends on some DLLs (e.g. Microsoft.Cci.dll) that cannot be loaded on s390x.

Reproduction Steps

On an s390x machine:

  • Install dotnet sdk 6.0.
  • Run ./build.sh

Expected behavior

The build succeeds.

Actual behavior

The build fails with:

/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018: The "ApiCompatTask" task failed unexpectedly. [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018: System.TypeLoadException: Could not load type System.Collections.Generic.IEqualityComparer`1[[Microsoft.Cci.ITypeReference, Microsoft.Cci, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a while decoding custom attribute: (null) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributesBase(ICustomAttributeProvider obj, Type attributeType, Boolean inheritedOnly) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributes(ICustomAttributeProvider obj, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttributeExtensions.GetCustomAttributes(MemberInfo element, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Util.DirectAttributeContext.GetCustomAttributes(Type reflectedType, MemberInfo member) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.Convention.AttributedModelProviderExtensions.GetDeclaredAttributes[ExportAttribute](AttributedModelProvider convention, Type reflectedType, MemberInfo member) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.<DiscoverPropertyExports>d__17.MoveNext() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.<DiscoverExports>d__0.MoveNext() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart(TypeInfo type, DiscoveredPart& part) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor(IEnumerable`1 types, AttributedModelProvider attributeContext) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.Hosting.ContainerConfiguration.CreateContainer() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.GetCompositionHost() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.GetDifferenceWriter(TextWriter writer, IDifferenceFilter filter, Boolean enforceOptionalRules, Boolean mdil, Boolean excludeNonBrowsable, Boolean includeInternals, Boolean excludeCompilerGenerated, String remapFile, Boolean groupByAssembly, String leftOperand, String rightOperand, IEnumerable`1 excludeAttributes, Boolean allowDefaultInterfaceMethods, Boolean usesMSBuildLog) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.Run(Boolean usesMSBuildLog, Boolean disableAssemblyResolveTraceListener, IEnumerable`1 contracts, IEnumerable`1 implementationDirectories, TextWriter output, String rightOperand, String leftOperand, Boolean listRules, IEnumerable`1 baselineFileNames, Boolean validateBaseline, Boolean resolveFramework, Boolean skipUnifyToLibPath, IEnumerable`1 contractDependsFileNames, String contractCoreAssembly, Boolean ignoreDesignTimeFacades, Boolean warnOnMissingAssemblies, Boolean respectInternals, Boolean warnOnIncorrectVersion, Boolean enforceOptionalRules, Boolean mdil, Boolean excludeNonBrowsable, Boolean excludeCompilerGenerated, String remapFile, Boolean skipGroupByAssembly, IEnumerable`1 excludeAttributes, Boolean allowDefaultInterfaceMethods) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.ApiCompatTask.Execute() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]

Regression?

Yes. Started with 2575ce5.

Known Workarounds

Cross-building from x86_64 still works.

Configuration

# uname -a
Linux dotnet-s390x 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:09:01 UTC 2022 s390x s390x s390x GNU/Linux

# dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         linux-s390x
 Base Path:   /root/dotnet-sdk-6.0.100-linux-s390x/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  N/A

.NET SDKs installed:
  6.0.100 [/root/dotnet-sdk-6.0.100-linux-s390x/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/root/dotnet-sdk-6.0.100-linux-s390x/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/root/dotnet-sdk-6.0.100-linux-s390x/shared/Microsoft.NETCore.App]

Other information

No response

Author: iii-i
Assignees: -
Labels:

area-Infrastructure-libraries, untriaged

Milestone: -

@ViktorHofer
Copy link
Member

The dependency on Microsoft.Cci didn't change with 2575ce5 but ApiCompat previously ran out-of-proc and now runs in-proc as an msbuild task. Could that explain why this suddenly popped up?

Any idea why this is only happening on s390x? As a workaround, you can specify /p:RunApiCompat=false when building to not invoke the ApiCompatTask.

@ViktorHofer ViktorHofer removed the untriaged New issue has not been triaged by the area owner label Apr 20, 2022
@ViktorHofer ViktorHofer added this to the 7.0.0 milestone Apr 20, 2022
@ViktorHofer ViktorHofer added the needs-author-action An issue or pull request that requires more info or actions from the author. label Apr 20, 2022
@ghost
Copy link

ghost commented Apr 20, 2022

This issue has been marked needs-author-action since it may be missing important information. Please refer to our contribution guidelines for tips on how to report issues effectively.

@jkotas jkotas added the arch-s390x Related to s390x architecture (unsupported) label Apr 20, 2022
@jkotas
Copy link
Member

jkotas commented Apr 20, 2022

This looks like a bug in the Mono runtime that ApiCompat happened to hit.

@ghost
Copy link

ghost commented Apr 20, 2022

Tagging subscribers to this area:
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

For some weeks it's no longer possible to build the master branch on s390x due to an ApiCompatTask failure.
It seems that this task depends on some DLLs (e.g. Microsoft.Cci.dll) that cannot be loaded on s390x.

Reproduction Steps

On an s390x machine:

  • Install dotnet sdk 6.0.
  • Run ./build.sh

Expected behavior

The build succeeds.

Actual behavior

The build fails with:

/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018: The "ApiCompatTask" task failed unexpectedly. [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018: System.TypeLoadException: Could not load type System.Collections.Generic.IEqualityComparer`1[[Microsoft.Cci.ITypeReference, Microsoft.Cci, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a while decoding custom attribute: (null) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributesBase(ICustomAttributeProvider obj, Type attributeType, Boolean inheritedOnly) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttribute.GetCustomAttributes(ICustomAttributeProvider obj, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Attribute.GetCustomAttributes(MemberInfo element, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Reflection.CustomAttributeExtensions.GetCustomAttributes(MemberInfo element, Boolean inherit) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Util.DirectAttributeContext.GetCustomAttributes(Type reflectedType, MemberInfo member) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.Convention.AttributedModelProviderExtensions.GetDeclaredAttributes[ExportAttribute](AttributedModelProvider convention, Type reflectedType, MemberInfo member) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.<DiscoverPropertyExports>d__17.MoveNext() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.<DiscoverExports>d__0.MoveNext() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart(TypeInfo type, DiscoveredPart& part) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor(IEnumerable`1 types, AttributedModelProvider attributeContext) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at System.Composition.Hosting.ContainerConfiguration.CreateContainer() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.GetCompositionHost() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.GetDifferenceWriter(TextWriter writer, IDifferenceFilter filter, Boolean enforceOptionalRules, Boolean mdil, Boolean excludeNonBrowsable, Boolean includeInternals, Boolean excludeCompilerGenerated, String remapFile, Boolean groupByAssembly, String leftOperand, String rightOperand, IEnumerable`1 excludeAttributes, Boolean allowDefaultInterfaceMethods, Boolean usesMSBuildLog) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.Executor.Run(Boolean usesMSBuildLog, Boolean disableAssemblyResolveTraceListener, IEnumerable`1 contracts, IEnumerable`1 implementationDirectories, TextWriter output, String rightOperand, String leftOperand, Boolean listRules, IEnumerable`1 baselineFileNames, Boolean validateBaseline, Boolean resolveFramework, Boolean skipUnifyToLibPath, IEnumerable`1 contractDependsFileNames, String contractCoreAssembly, Boolean ignoreDesignTimeFacades, Boolean warnOnMissingAssemblies, Boolean respectInternals, Boolean warnOnIncorrectVersion, Boolean enforceOptionalRules, Boolean mdil, Boolean excludeNonBrowsable, Boolean excludeCompilerGenerated, String remapFile, Boolean skipGroupByAssembly, IEnumerable`1 excludeAttributes, Boolean allowDefaultInterfaceMethods) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.DotNet.ApiCompat.ApiCompatTask.Execute() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]
/root/.nuget/packages/microsoft.dotnet.apicompat/7.0.0-beta.22179.1/build/Microsoft.DotNet.ApiCompat.targets(52,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/root/dotnet-s390x/runtime/src/libraries/System.Drawing.Primitives/src/System.Drawing.Primitives.csproj]

Regression?

Yes. Started with 2575ce5.

Known Workarounds

Cross-building from x86_64 still works.

Configuration

# uname -a
Linux dotnet-s390x 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:09:01 UTC 2022 s390x s390x s390x GNU/Linux

# dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         linux-s390x
 Base Path:   /root/dotnet-sdk-6.0.100-linux-s390x/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  N/A

.NET SDKs installed:
  6.0.100 [/root/dotnet-sdk-6.0.100-linux-s390x/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/root/dotnet-sdk-6.0.100-linux-s390x/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/root/dotnet-sdk-6.0.100-linux-s390x/shared/Microsoft.NETCore.App]

Other information

No response

Author: iii-i
Assignees: -
Labels:

area-Infrastructure-libraries, area-AssemblyLoader-mono, arch-s390x, needs-author-action

Milestone: 7.0.0

@ViktorHofer
Copy link
Member

This looks like a bug in the Mono runtime that ApiCompat happened to hit.

@jkotas just curious, how did you come to that conclusion? Did you repro the issue locally?

@jkotas
Copy link
Member

jkotas commented Apr 20, 2022

I did not repro the issue locally.

The key difference between Linux x64 hosted and Linux s390x build is that the Linux x64 hosted build is using CoreCLR and the Linux s390x build is using Mono. If something works fine in Linux x64 hosted and fails in Linux s390x hosted build, it is most likely a Mono bug.

It may be worth it to try building on Linux x64 with CoreCLR overridden with Mono. It should fail as well if my theory is correct.

@iii-i
Copy link
Contributor Author

iii-i commented Apr 25, 2022

The x86_64 build with <PrimaryRuntimeFlavor>Mono</PrimaryRuntimeFlavor> worked fine for me. This can still be an endianness bug - I'll try to debug further.

@ghost ghost added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs-author-action An issue or pull request that requires more info or actions from the author. labels Apr 25, 2022
iii-i added a commit to iii-i/runtime that referenced this issue Jun 7, 2022
…#68266)

Running ApiCompat task under Mono fails with:

    Could not load type System.Collections.Generic.IEqualityComparer`1[[Microsoft.Cci.ITypeReference, Microsoft.Cci ...

The reason is that cattr_type_from_name() uses a default ACL instead of
the image's one. This is important, because ExportCciSettings.Settings
field has the

      [Export(typeof(IEqualityComparer<ITypeReference>))]

custom attribute [1], where ITypeReference comes from the Microsoft.Cci
assembly. ApiCompat task runs under MSBuild, which provides its own
MSBuildLoadContext ALC. Microsoft.Cci is supposed to be found using
this ALC, not the default one.

[1] https://github.com/dotnet/arcade/blob/8f311fed1f2acf0ecfdfcecbc7a9fa871ed634cc/src/Microsoft.DotNet.ApiCompat/src/Microsoft.DotNet.ApiCompat.Core/ExportCciSettings.cs#L28
@iii-i
Copy link
Contributor Author

iii-i commented Jun 7, 2022

After all, this is a Mono vs CoreCLR issue.
The problem with my old test was that I built dotnet with a custom PrimaryRuntimeFlavor once, which was not enough (the "host" dotnet did not have that issue, so it did not surface during the build).
Here is the PR with more details in the commit message: #70346.

lambdageek added a commit that referenced this issue Jul 1, 2022
#70346)

* [custom_attrs] Use the image's ALC instead of the default one (#68266)

Running ApiCompat task under Mono fails with:

    Could not load type System.Collections.Generic.IEqualityComparer`1[[Microsoft.Cci.ITypeReference, Microsoft.Cci ...

The reason is that cattr_type_from_name() uses a default ACL instead of
the image's one. This is important, because ExportCciSettings.Settings
field has the

      [Export(typeof(IEqualityComparer<ITypeReference>))]

custom attribute [1], where ITypeReference comes from the Microsoft.Cci
assembly. ApiCompat task runs under MSBuild, which provides its own
MSBuildLoadContext ALC. Microsoft.Cci is supposed to be found using
this ALC, not the default one.

[1] https://github.com/dotnet/arcade/blob/8f311fed1f2acf0ecfdfcecbc7a9fa871ed634cc/src/Microsoft.DotNet.ApiCompat/src/Microsoft.DotNet.ApiCompat.Core/ExportCciSettings.cs#L28

* [sre] Set the ALC for the dynamic image

   Don't leave it NULL

Co-authored-by: Aleksey Kliger <[email protected]>
@lambdageek
Copy link
Member

Fixed by #70346

@ghost ghost locked as resolved and limited conversation to collaborators Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-s390x Related to s390x architecture (unsupported) area-AssemblyLoader-mono needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Projects
None yet
Development

No branches or pull requests

6 participants