dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.05k stars 4.03k forks source link

Assert failure when building runtime: Synthesized attribute constructor missing #75032

Closed 333fred closed 1 month ago

333fred commented 2 months ago

Version Used: 9cf652f838e2e09872f9f03ebdd00b353c480d13

Happens when building the src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj project. From the stack, the DefaultMemberAttribute constructor is not present, and we expect it to be.

/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error : Process terminated. Assertion failed. [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.TrySynthesizeAttribute(WellKnownMember constructor, ImmutableArray`1 arguments, ImmutableArray`1 namedArguments, Boolean isOptionalUse) in /workspaces/roslyn/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs:line 399 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamedTypeSymbol.AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, ArrayBuilder`1& attributes) in /workspaces/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs:line 1714 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.Symbol.GetCustomAttributesToEmit(PEModuleBuilder moduleBuilder, Boolean emittingAssemblyAttributesInNetModule) in /workspaces/roslyn/src/Compilers/CSharp/Portable/Emitter/Model/SymbolAdapter.cs:line 100 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.Symbol.GetCustomAttributesToEmit(PEModuleBuilder moduleBuilder) in /workspaces/roslyn/src/Compilers/CSharp/Portable/Emitter/Model/SymbolAdapter.cs:line 89 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.SymbolAdapter.Microsoft.Cci.IReference.GetAttributes(EmitContext context) in /workspaces/roslyn/src/Compilers/CSharp/Portable/Emitter/Model/SymbolAdapter.cs:line 43 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.Cci.ReferenceIndexerBase.VisitTypeDefinitionNoMembers(ITypeDefinition typeDefinition) in /workspaces/roslyn/src/Compilers/Core/Portable/PEWriter/ReferenceIndexerBase.cs:line 273 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.Cci.ReferenceIndexerBase.Visit(ITypeDefinition typeDefinition) in /workspaces/roslyn/src/Compilers/Core/Portable/PEWriter/ReferenceIndexerBase.cs:line 299 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.Cci.MetadataVisitor.Visit(IEnumerable`1 types) in /workspaces/roslyn/src/Compilers/Core/Portable/PEWriter/MetadataVisitor.cs:line 379 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.Cci.ReferenceIndexer.Visit(CommonPEModuleBuilder module) in /workspaces/roslyn/src/Compilers/Core/Portable/PEWriter/ReferenceIndexer.cs:line 35 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.Cci.MetadataWriter.CreateIndices() in /workspaces/roslyn/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs:line 483 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.Cci.MetadataWriter.BuildMetadataAndIL(PdbWriter nativePdbWriterOpt, BlobBuilder ilBuilder, PooledBlobBuilder& mappedFieldDataBuilder, PooledBlobBuilder& managedResourceDataBuilder, Blob& mvidFixup, Blob& mvidStringFixup) in /workspaces/roslyn/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs:line 1779 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.Cci.PeWriter.WritePeToStream(EmitContext context, CommonMessageProvider messageProvider, Func`1 getPeStream, Func`1 getPortablePdbStreamOpt, PdbWriter nativePdbWriterOpt, String pdbPathOpt, Boolean metadataOnly, Boolean isDeterministic, Boolean emitTestCoverageData, Nullable`1 privateKeyOpt, CancellationToken cancellationToken) in /workspaces/roslyn/src/Compilers/Core/Portable/PEWriter/PeWriter.cs:line 111 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.Compilation.SerializePeToStream(CommonPEModuleBuilder moduleBeingBuilt, DiagnosticBag metadataDiagnostics, CommonMessageProvider messageProvider, Func`1 getPeStream, Func`1 getMetadataPeStreamOpt, Func`1 getPortablePdbStreamOpt, PdbWriter nativePdbWriterOpt, String pdbPathOpt, RebuildData rebuildData, Boolean metadataOnly, Boolean includePrivateMembers, Boolean isDeterministic, Boolean emitTestCoverageData, Nullable`1 privateKeyOpt, CancellationToken cancellationToken) in /workspaces/roslyn/src/Compilers/Core/Portable/Compilation/Compilation.cs:line 3361 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.Compilation.SerializeToPeStream(CommonPEModuleBuilder moduleBeingBuilt, EmitStreamProvider peStreamProvider, EmitStreamProvider metadataPEStreamProvider, EmitStreamProvider pdbStreamProvider, RebuildData rebuildData, Func`2 testSymWriterFactory, DiagnosticBag diagnostics, EmitOptions emitOptions, Nullable`1 privateKeyOpt, CancellationToken cancellationToken) in /workspaces/roslyn/src/Compilers/Core/Portable/Compilation/Compilation.cs:line 3260 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CommonCompiler.CompileAndEmit(TouchedFileLogger touchedFilesLogger, Compilation& compilation, ImmutableArray`1 analyzers, ImmutableArray`1 generators, ImmutableArray`1 additionalTextFiles, AnalyzerConfigSet analyzerConfigSet, ImmutableArray`1 sourceFileAnalyzerConfigOptions, ImmutableArray`1 embeddedTexts, DiagnosticBag diagnostics, ErrorLogger errorLogger, CancellationToken cancellationToken, CancellationTokenSource& analyzerCts, AnalyzerDriver& analyzerDriver, Nullable`1& generatorTimingInfo) in /workspaces/roslyn/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs:line 1445 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogger errorLogger, CancellationToken cancellationToken) in /workspaces/roslyn/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs:line 956 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationToken cancellationToken) in /workspaces/roslyn/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs:line 781 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.<>c__DisplayClass1_0.<Run>b__0(TextWriter tw) in /workspaces/roslyn/src/Compilers/Shared/Csc.cs:line 28 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CommandLine.ConsoleUtil.RunWithUtf8Output[T](Boolean utf8Output, TextWriter textWriter, Func`2 func) in /workspaces/roslyn/src/Compilers/Core/CommandLine/ConsoleUtil.cs:line 53 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Csc.Run(String[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader) in /workspaces/roslyn/src/Compilers/Shared/Csc.cs:line 28 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunLocalCompilation(String[] arguments, BuildPaths buildPaths, TextWriter textWriter) in /workspaces/roslyn/src/Compilers/Shared/BuildClient.cs:line 196 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.RunCompilation(IEnumerable`1 originalArguments, BuildPaths buildPaths, TextWriter textWriter, String pipeName) in /workspaces/roslyn/src/Compilers/Shared/BuildClient.cs:line 167 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CommandLine.BuildClient.Run(IEnumerable`1 arguments, RequestLanguage language, CompileFunc compileFunc, CompileOnServerFunc compileOnServerFunc, ICompilerServerLogger logger) in /workspaces/roslyn/src/Compilers/Shared/BuildClient.cs:line 117 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.MainCore(String[] args) in /workspaces/roslyn/src/Compilers/CSharp/csc/Program.cs:line 37 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
/home/vscode/.nuget/packages/microsoft.net.compilers.toolset/4.12.0-dev/tasks/netcore/Microsoft.CSharp.Core.targets(89,5): error :    at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(String[] args) in /workspaces/roslyn/src/Compilers/CSharp/csc/Program.cs:line 18 [/workspaces/runtime/src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj]
333fred commented 2 months ago

Here's the complog: Build.zip. Just rename back to Build.complog after downloading. Failing project is Test.CoreLib

333fred commented 1 month ago

@agocke y'all will need to include this attribute in the test project when you take your next compiler update.

agocke commented 1 month ago

Done: https://github.com/dotnet/runtime/pull/108236