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

APICompat exceptions when building on MacOS arm64 #56598

Closed
steveisok opened this issue Jul 30, 2021 · 12 comments
Closed

APICompat exceptions when building on MacOS arm64 #56598

steveisok opened this issue Jul 30, 2021 · 12 comments

Comments

@steveisok
Copy link
Member

On an M1, execute

./build.sh -Subset mono+libs -os iOSSimulator -arch arm64

Apicompat will throw this:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
     at System.SZArrayHelper.GetEnumerator[T]() in System.Private.CoreLib.dll:token 0x600015f+0x0
     at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate) in System.Linq.dll:token 0x6000044+0x14
     at System.Composition.TypedParts.ActivationFeatures.PropertyInjectionFeature.<GetDependencies>b__5(<>f__AnonymousType1`2 <>h__TransparentIdentifier1) in System.Composition.TypedParts.dll:token 0x600003e+0x1e
     at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.ToArray() in System.Linq.dll:token 0x600024e+0x1d
     at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) in System.Linq.dll:token 0x600011a+0x1b
     at System.Composition.TypedParts.ActivationFeatures.PropertyInjectionFeature.GetDependencies(TypeInfo partType, DependencyAccessor definitionAccessor) in System.Composition.TypedParts.dll:token 0x6000039+0x97
     at System.Composition.TypedParts.Discovery.DiscoveredPart.<>c__DisplayClass7.<GetDependencies>b__4(ActivationFeature feature) in System.Composition.TypedParts.dll:token 0x60000bf+0x0
     at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext() in System.Linq.dll:token 0x6000219+0x51
     at System.Linq.Enumerable.ConcatIterator`1.MoveNext() in System.Linq.dll:token 0x6000169+0x2b
     at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray() in System.Linq.dll:token 0x6000227+0x33
     at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) in System.Linq.dll:token 0x600011a+0x1b
     at System.Composition.TypedParts.Discovery.DiscoveredPart.GetDependencies(DependencyAccessor definitionAccessor) in System.Composition.TypedParts.dll:token 0x6000061+0x4f
     at System.Composition.TypedParts.Discovery.DiscoveredExport.<>c__DisplayClass2.<GetExportDescriptorPromise>b__0() in System.Composition.TypedParts.dll:token 0x60000ba+0x0
     at System.Composition.Hosting.Core.ExportDescriptorPromise.<>c__DisplayClass4.<.ctor>b__0() in System.Composition.Hosting.dll:token 0x60000c2+0x0
     at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode) in System.Private.CoreLib.dll:token 0x6001076+0x1c
     at System.Lazy`1.CreateValue() in System.Private.CoreLib.dll:token 0x600107c+0x47
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckTarget(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000058+0x53
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckDependency(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000059+0xcd
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckTarget(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000058+0x74
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckDependency(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000059+0xcd
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckTarget(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000058+0x74
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.Execute(CompositionContract contract) in System.Composition.Hosting.dll:token 0x6000057+0x30
     at System.Composition.Hosting.Core.ExportDescriptorRegistry.TryGetSingleForExport(CompositionContract exportKey, ExportDescriptor& defaultForExport) in System.Composition.Hosting.dll:token 0x6000055+0x4f
     at System.Composition.Hosting.Core.LifetimeContext.TryGetExport(CompositionContract contract, Object& export) in System.Composition.Hosting.dll:token 0x6000066+0x0
     at System.Composition.Hosting.CompositionHost.TryGetExport(CompositionContract contract, Object& export) in System.Composition.Hosting.dll:token 0x6000009+0x0
     at System.Composition.CompositionContext.GetExport(CompositionContract contract) in System.Composition.Runtime.dll:token 0x6000011+0x0
     at System.Composition.CompositionContext.GetExports(Type exportType, String contractName) in System.Composition.Runtime.dll:token 0x6000013+0x25
     at System.Composition.CompositionContext.GetExports[TExport](String contractName) in System.Composition.Runtime.dll:token 0x6000015+0x0
     at System.Composition.CompositionContext.GetExports[TExport]() in System.Composition.Runtime.dll:token 0x6000014+0x0
     at Microsoft.Cci.Differs.ElementDifferenceFactory.GetDifferenceRules[T]() in /_/src/Microsoft.Cci.Extensions/Differs/ElementDifferenceFactory.cs:line 50
     at Microsoft.Cci.Differs.ElementDifferenceFactory.GetDiffer[T](ElementMapping`1 element) in /_/src/Microsoft.Cci.Extensions/Differs/ElementDifferenceFactory.cs:line 40
     at Microsoft.Cci.Mappings.ElementMapping`1.get_Differences() in /_/src/Microsoft.Cci.Extensions/Mappings/ElementMapping.cs:line 93
     at Microsoft.Cci.Traversers.DifferenceTraverser.Visit(AssemblySetMapping mapping) in /_/src/Microsoft.Cci.Extensions/Traversers/DifferenceTraverser.cs:line 36
     at Microsoft.Cci.Traversers.DifferenceTraverser.Visit(IEnumerable`1 oldAssemblies, IEnumerable`1 newAssemblies) in /_/src/Microsoft.Cci.Extensions/Traversers/DifferenceTraverser.cs:line 31
     at Microsoft.Cci.Writers.DifferenceWriter.Write(String oldAssembliesName, IEnumerable`1 oldAssemblies, String newAssembliesName, IEnumerable`1 newAssemblies) in /_/src/Microsoft.DotNet.ApiCompat/src/DifferenceWriter.cs:line 36
     at Microsoft.DotNet.ApiCompat.ApiCompatRunner.<>c__DisplayClass5_0.<CreateApp>b__0() in /_/src/Microsoft.DotNet.ApiCompat/src/ApiCompatRunner.cs:line 160
     at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) in McMaster.Extensions.CommandLineUtils.dll:token 0x60000c9+0x33
     at Microsoft.DotNet.ApiCompat.ApiCompatRunner.Run(String[] args) in /_/src/Microsoft.DotNet.ApiCompat/src/ApiCompatRunner.cs:line 41
     at Microsoft.DotNet.ApiCompat.Program.Main(String[] args) in /_/src/Microsoft.DotNet.ApiCompat/src/Program.cs:line 10

And then right below:

  Microsoft.Win32.Registry -> /Users/steve/dev/ios-runtime/artifacts/bin/Microsoft.Win32.Registry/net6.0-Debug/Microsoft.Win32.Registry.dll
  /var/folders/86/rdltn_wn3k74x4z1yt_xx0jm0000gn/T/tmp81b117bc244445d492d7930631d05ff9.exec.cmd: line 2:  3031 Abort trap: 6           "/Users/steve/dev/ios-runtime/.dotnet/dotnet" "/Users/steve/.nuget/packages/microsoft.dotnet.apicompat/6.0.0-beta.21370.12/build//../tools/netcoreapp3.1/Microsoft.DotNet.ApiCompat.dll" @"/Users/steve/dev/ios-runtime/artifacts/obj/System.Net.HttpListener/net6.0-Unix-Debug/apicompat.rsp"

/Users/steve/.nuget/packages/microsoft.dotnet.apicompat/6.0.0-beta.21370.12/build/Microsoft.DotNet.ApiCompat.targets(96,5): error : ApiCompat failed for '/Users/steve/dev/ios-runtime/artifacts/bin/System.Net.HttpListener/net6.0-Unix-Debug/System.Net.HttpListener.dll' [/Users/steve/dev/ios-runtime/src/libraries/System.Net.HttpListener/src/System.Net.HttpListener.csproj]
@ghost
Copy link

ghost commented Jul 30, 2021

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

Issue Details

On an M1, execute

./build.sh -Subset mono+libs -os iOSSimulator -arch arm64

Apicompat will throw this:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
     at System.SZArrayHelper.GetEnumerator[T]() in System.Private.CoreLib.dll:token 0x600015f+0x0
     at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate) in System.Linq.dll:token 0x6000044+0x14
     at System.Composition.TypedParts.ActivationFeatures.PropertyInjectionFeature.<GetDependencies>b__5(<>f__AnonymousType1`2 <>h__TransparentIdentifier1) in System.Composition.TypedParts.dll:token 0x600003e+0x1e
     at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.ToArray() in System.Linq.dll:token 0x600024e+0x1d
     at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) in System.Linq.dll:token 0x600011a+0x1b
     at System.Composition.TypedParts.ActivationFeatures.PropertyInjectionFeature.GetDependencies(TypeInfo partType, DependencyAccessor definitionAccessor) in System.Composition.TypedParts.dll:token 0x6000039+0x97
     at System.Composition.TypedParts.Discovery.DiscoveredPart.<>c__DisplayClass7.<GetDependencies>b__4(ActivationFeature feature) in System.Composition.TypedParts.dll:token 0x60000bf+0x0
     at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext() in System.Linq.dll:token 0x6000219+0x51
     at System.Linq.Enumerable.ConcatIterator`1.MoveNext() in System.Linq.dll:token 0x6000169+0x2b
     at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray() in System.Linq.dll:token 0x6000227+0x33
     at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) in System.Linq.dll:token 0x600011a+0x1b
     at System.Composition.TypedParts.Discovery.DiscoveredPart.GetDependencies(DependencyAccessor definitionAccessor) in System.Composition.TypedParts.dll:token 0x6000061+0x4f
     at System.Composition.TypedParts.Discovery.DiscoveredExport.<>c__DisplayClass2.<GetExportDescriptorPromise>b__0() in System.Composition.TypedParts.dll:token 0x60000ba+0x0
     at System.Composition.Hosting.Core.ExportDescriptorPromise.<>c__DisplayClass4.<.ctor>b__0() in System.Composition.Hosting.dll:token 0x60000c2+0x0
     at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode) in System.Private.CoreLib.dll:token 0x6001076+0x1c
     at System.Lazy`1.CreateValue() in System.Private.CoreLib.dll:token 0x600107c+0x47
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckTarget(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000058+0x53
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckDependency(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000059+0xcd
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckTarget(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000058+0x74
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckDependency(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000059+0xcd
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.CheckTarget(CompositionDependency dependency, HashSet`1 checked, Stack`1 checking) in System.Composition.Hosting.dll:token 0x6000058+0x74
     at System.Composition.Hosting.Core.ExportDescriptorRegistryUpdate.Execute(CompositionContract contract) in System.Composition.Hosting.dll:token 0x6000057+0x30
     at System.Composition.Hosting.Core.ExportDescriptorRegistry.TryGetSingleForExport(CompositionContract exportKey, ExportDescriptor& defaultForExport) in System.Composition.Hosting.dll:token 0x6000055+0x4f
     at System.Composition.Hosting.Core.LifetimeContext.TryGetExport(CompositionContract contract, Object& export) in System.Composition.Hosting.dll:token 0x6000066+0x0
     at System.Composition.Hosting.CompositionHost.TryGetExport(CompositionContract contract, Object& export) in System.Composition.Hosting.dll:token 0x6000009+0x0
     at System.Composition.CompositionContext.GetExport(CompositionContract contract) in System.Composition.Runtime.dll:token 0x6000011+0x0
     at System.Composition.CompositionContext.GetExports(Type exportType, String contractName) in System.Composition.Runtime.dll:token 0x6000013+0x25
     at System.Composition.CompositionContext.GetExports[TExport](String contractName) in System.Composition.Runtime.dll:token 0x6000015+0x0
     at System.Composition.CompositionContext.GetExports[TExport]() in System.Composition.Runtime.dll:token 0x6000014+0x0
     at Microsoft.Cci.Differs.ElementDifferenceFactory.GetDifferenceRules[T]() in /_/src/Microsoft.Cci.Extensions/Differs/ElementDifferenceFactory.cs:line 50
     at Microsoft.Cci.Differs.ElementDifferenceFactory.GetDiffer[T](ElementMapping`1 element) in /_/src/Microsoft.Cci.Extensions/Differs/ElementDifferenceFactory.cs:line 40
     at Microsoft.Cci.Mappings.ElementMapping`1.get_Differences() in /_/src/Microsoft.Cci.Extensions/Mappings/ElementMapping.cs:line 93
     at Microsoft.Cci.Traversers.DifferenceTraverser.Visit(AssemblySetMapping mapping) in /_/src/Microsoft.Cci.Extensions/Traversers/DifferenceTraverser.cs:line 36
     at Microsoft.Cci.Traversers.DifferenceTraverser.Visit(IEnumerable`1 oldAssemblies, IEnumerable`1 newAssemblies) in /_/src/Microsoft.Cci.Extensions/Traversers/DifferenceTraverser.cs:line 31
     at Microsoft.Cci.Writers.DifferenceWriter.Write(String oldAssembliesName, IEnumerable`1 oldAssemblies, String newAssembliesName, IEnumerable`1 newAssemblies) in /_/src/Microsoft.DotNet.ApiCompat/src/DifferenceWriter.cs:line 36
     at Microsoft.DotNet.ApiCompat.ApiCompatRunner.<>c__DisplayClass5_0.<CreateApp>b__0() in /_/src/Microsoft.DotNet.ApiCompat/src/ApiCompatRunner.cs:line 160
     at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) in McMaster.Extensions.CommandLineUtils.dll:token 0x60000c9+0x33
     at Microsoft.DotNet.ApiCompat.ApiCompatRunner.Run(String[] args) in /_/src/Microsoft.DotNet.ApiCompat/src/ApiCompatRunner.cs:line 41
     at Microsoft.DotNet.ApiCompat.Program.Main(String[] args) in /_/src/Microsoft.DotNet.ApiCompat/src/Program.cs:line 10

And then right below:

  Microsoft.Win32.Registry -> /Users/steve/dev/ios-runtime/artifacts/bin/Microsoft.Win32.Registry/net6.0-Debug/Microsoft.Win32.Registry.dll
  /var/folders/86/rdltn_wn3k74x4z1yt_xx0jm0000gn/T/tmp81b117bc244445d492d7930631d05ff9.exec.cmd: line 2:  3031 Abort trap: 6           "/Users/steve/dev/ios-runtime/.dotnet/dotnet" "/Users/steve/.nuget/packages/microsoft.dotnet.apicompat/6.0.0-beta.21370.12/build//../tools/netcoreapp3.1/Microsoft.DotNet.ApiCompat.dll" @"/Users/steve/dev/ios-runtime/artifacts/obj/System.Net.HttpListener/net6.0-Unix-Debug/apicompat.rsp"

/Users/steve/.nuget/packages/microsoft.dotnet.apicompat/6.0.0-beta.21370.12/build/Microsoft.DotNet.ApiCompat.targets(96,5): error : ApiCompat failed for '/Users/steve/dev/ios-runtime/artifacts/bin/System.Net.HttpListener/net6.0-Unix-Debug/System.Net.HttpListener.dll' [/Users/steve/dev/ios-runtime/src/libraries/System.Net.HttpListener/src/System.Net.HttpListener.csproj]
Author: steveisok
Assignees: -
Labels:

area-Infrastructure

Milestone: -

@safern
Copy link
Member

safern commented Jul 30, 2021

I believe this is a known issue, a limitation of CCI, but not sure. I couldn't find the issue I remembered seeing this discussed. @ericstj do you recall?

@steveisok to unblock yourself you can build with /p:RunApiCompat=false

@karelz karelz added the untriaged New issue has not been triaged by the area owner label Jul 30, 2021
@ViktorHofer
Copy link
Member

@safern is the plan still to switch away from ApiCompat in arcade to the new one under dotnet/sdk? If yes, what are the remaining missing features to do so?

@safern
Copy link
Member

safern commented Jul 30, 2021

@safern is the plan still to switch away from ApiCompat in arcade to the new one under dotnet/sdk?

Yes that is the plan, however I think that'll come post 6.0 work.

If yes, what are the remaining missing features to do so?

We still have a few rules missing in order to be able to do that, and also the MSBuild task to run API Compat within MSBuild context, but that one should be done soon.

@ViktorHofer
Copy link
Member

Great to hear 👍 Do we have a tracking issue that I can follow along for switching over to the new ApiCompat?

@safern
Copy link
Member

safern commented Jul 30, 2021

I think this is good issue listing the tasks we need to achieve to replace the old API Compat: dotnet/sdk#18678

@vcsjones
Copy link
Member

vcsjones commented Aug 1, 2021

Could this be related to #51250? Seems that M1 has sporadic NREs or other memory access violations.

@steveisok
Copy link
Member Author

From what I tried, it's a consistent error, so i'm not sure the issue is related.

@ericstj
Copy link
Member

ericstj commented Aug 2, 2021

This is different from the previous ARM-related CCI bug caused by alignment. This code is just running LINQ over normal reflection as part of MEF2 composition. If there is a bug here it's most likely one in the product itself (whatever version we are running tools on during the build).

@safern
Copy link
Member

safern commented Aug 2, 2021

@steveisok does this repro with a specific version of the SDK? Could you capture a dump or more info on what version of the product it is happening?

@ViktorHofer ViktorHofer added this to the 6.0.0 milestone Aug 10, 2021
@ViktorHofer ViktorHofer removed the untriaged New issue has not been triaged by the area owner label Aug 10, 2021
@ViktorHofer
Copy link
Member

@steveisok in addition to @safern's question, should we keep this in 6.0 or move the 7.0?

@steveisok
Copy link
Member Author

@safern it was off of main, so it was likely either p5 or p6.

I tried main fairly recently and I don't think this is an issue an longer.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants