Repository navigation
Closed
dotnet/arcade
#9254Closed
Copy link
Milestone
Description
2>------ Build started: Project: System.Runtime (src\System.Runtime), Configuration: Debug Any CPU ------
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : Compat issues with assembly System.Runtime:
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Lazy<T>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Memory<T>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.ReadOnlyMemory<T>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.ReadOnlySpan<T>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Span<T>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.OutputTabsAsync()' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteAsync(System.Char)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteAsync(System.Char[], System.Int32, System.Int32)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteAsync(System.ReadOnlyMemory<System.Char>, System.Threading.CancellationToken)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteAsync(System.String)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteAsync(System.Text.StringBuilder, System.Threading.CancellationToken)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteLineAsync()' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteLineAsync(System.Char)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteLineAsync(System.Char[], System.Int32, System.Int32)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteLineAsync(System.ReadOnlyMemory<System.Char>, System.Threading.CancellationToken)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteLineAsync(System.String)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.CodeDom.Compiler.IndentedTextWriter.WriteLineAsync(System.Text.StringBuilder, System.Threading.CancellationToken)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Collections.ArrayList' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Collections.Hashtable' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Collections.ObjectModel.Collection<T>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Collections.ObjectModel.ReadOnlyCollection<T>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>.KeyCollection' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>.ValueCollection' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.IO.BufferedStream.DisposeAsync()' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.IO.FileStream.DisposeAsync()' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.IO.TextReader.ReadToEndAsync(System.Threading.CancellationToken)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Reflection.TypeInfo.DeclaredNestedTypes.get()' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Reflection.TypeInfo.GetDeclaredMethods(System.String)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Threading.Timer' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Threading.Tasks.ConcurrentExclusiveSchedulerPair' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Threading.Tasks.Task' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Threading.Tasks.Task<TResult>' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Threading.Tasks.TaskAsyncEnumerableExtensions.ToBlockingEnumerable<T>(System.Collections.Generic.IAsyncEnumerable<T>, System.Threading.CancellationToken)' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Threading.Tasks.TaskScheduler' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Threading.Tasks.ValueTask' in the implementation but not the reference.
2>C:\Users\vihofer\.nuget\packages\microsoft.dotnet.apicompat\7.0.0-beta.22179.1\build\Microsoft.DotNet.ApiCompat.targets(94,5): error : CannotRemoveAttribute : Attribute 'Microsoft.Cci.DummyTypeReference' exists on 'System.Threading.Tasks.ValueTask<TResult>' in the implementation but not the reference.
2>System.Runtime -> C:\git\runtime5\artifacts\bin\System.Runtime\Debug\net7.0\System.Runtime.dll
2>Done building project "System.Runtime.csproj".
========== Build: 2 succeeded, 0 failed, 4 up-to-date, 0 skipped ==========
Repro:
.\build.cmd libs
.\build.cmd -vs System.Runtime
Build the source project of System.Runtime
Build the source project of System.Runtime again after applying a comment change
If a binlog is required, make sure to set the env vars described in https://github.com/dotnet/project-system-tools/blob/main/README.md#getting-higher-fidelity-logs-from-vs-vs2022-onwards to get more diagnostics.
Apparently these errors also don't fail the build of System.Runtime, which is yet another bug.
@ericstj can you please take a look?
Activity
ericstj commentedon Apr 29, 2022
It looks like the
ExitCodemay have always returned 0 but the non-zero exit code came from Exec which returned -1 when the command logged errors:https://github.com/dotnet/msbuild/blob/10dbde3bf1986251a5e958af8c7391ad0d9e7f11/src/Utilities/ToolTask.cs#L761-L765
So we lost that when moving to ApiCompatTask. Probably we just need to do something similar before returning here: https://github.com/dotnet/arcade/blob/2a91e85b18e375ccb015f52ca3fe01e07601998e/src/Microsoft.DotNet.ApiCompat/src/ApiCompatTask.cs#L210
An observation: the first build is building
System.Private.Coreliband notSystem.Runtimewhich seems unusual to me. So the first build never has a chance to run APICompat which is why it passes.I can reproduce the same behavior you see in the IDE by running from the command-line using
MSBuild.Likely this didn't happen before because API compat was run out of proc. I can run the desktop version of API compat from the commandline in its current form and also reproduce the issue:
Of course we never did that before because we'd always run the .NETCore version out of proc (even in VS).
CCI needs to know the core-assembly in order to resolve types and you'll see these
Microsoft.Cci.DummyTypeReferencetypes when it gets it wrong. So probably the resolution of theSystem.Runtimeimplementation facade never worked well on .NETFramework. One of CCI's quirks is that it falls back to using the executing core assembly if it can't find one.https://github.com/microsoft/cci/blob/659f31f9736a1e8ded870ee2132d91f87505148e/CoreObjectModel/MetadataHelper/Core.cs#L189-L197
That explains why it fails on .NETFramework but works on .NETCore.
ericstj commentedon Apr 30, 2022
Just got a bit more time and debugged this and confirm that it chooses
mscorlibfor the core assembly:There's some logic in CCI.Extensions that tries to find the core assembly by looking for typerefs to common types. https://github.com/microsoft/cci/blob/659f31f9736a1e8ded870ee2132d91f87505148e/PEReaderAndWriter/PEReader/PEFileToObjectModel.cs#L225-L344
The problem is that this fails for System.Runtime facade since it only references 18 types (mostly attributes) and none of those are in that list. Had that probed the ExportedTypeTable (where TypeForwards are defined) it would have found them.
After that it looks for type defs for object (fails since we forward it) and then it looks for references to System.Runtime or mscorlib (both fail of course).
We have a parameter called
--contract-core-assemblywhich was added here https://mseng.visualstudio.com/Tools/_git/CoreFxTools/commit/a6ac67be62dd772841bb29459f41b93f781276dc?path=/Src/Microsoft.Cci.Extensions/HostEnvironment.cs&_a=contentsThat doesn't quite solve this case, as it assumes that the core-assembly is part of the set of contracts, which is not the case here for System.Runtime's implementation - the core assembly should be System.Private.Corelib and that assembly should not be part of the contract set (since it won't exist in references). We could build upon that hack to allow it to load a core-assembly from the probing paths but then we'd have to specify that in the project.
The best fix here would be to change CCI to consider the ExportedTypeTable but that's not likely to happen since we can't change CCI. I think we might be able to implement that in CCI extensions but I'll need to see.
ericstj commentedon May 2, 2022
I have a fix for this and the issue that prevents the build from failing. Will test and put up a PR in arcade.
ViktorHofer commentedon May 2, 2022
Thanks Eric for your investigation and help.