Skip to content

"System.ArgumentException: type" while publishing NativeAOT console app with IlcGenerateMstatFile=true #86376

Description

@vonzshik

Description

After upgrading to .NET 8 Preview 4 we started to encounter error while publishing Npgsql's NativeAOT test example:

<unknown>:0: error: Undefined temporary symbol 
EXEC : error : type [/home/runner/work/npgsql/npgsql/test/Npgsql.NativeAotTests/Npgsql.NativeAotTests.csproj::TargetFramework=net8.0]
  System.ArgumentException: type
     at Internal.TypeSystem.TypeSystemMetadataEmitter.GetTypeRef(TypeDesc) + 0x79
     at Internal.TypeSystem.TypeSystemMetadataEmitter.EmitMetadataHandleForTypeSystemEntity(TypeSystemEntity) + 0xa2
     at ILCompiler.MstatObjectDumper.DumpObjectNode(NodeFactory, ObjectNode, ObjectNode.ObjectData) + 0xde
     at ILCompiler.DependencyAnalysis.ObjectWriter.EmitObject(String, IReadOnlyCollection`1, NodeFactory, ObjectWritingOptions, IObjectDumper, Logger) + 0x339
     at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x[32](https://github.com/npgsql/npgsql/actions/runs/5001669554/jobs/8960645836#step:6:33)
     at ILCompiler.Program.Run() + 0x19be
     at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass206_0.<.ctor>b__0(InvocationContext context) + 0x201
/home/runner/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/build/Microsoft.NETCore.Native.targets(270,5): error MSB3073: The command ""/home/runner/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/8.0.0-preview.4.23259.5/tools/ilc" @"obj/Release/net8.0/linux-x64/native/Npgsql.NativeAotTests.ilc.rsp"" exited with code 1. [/home/runner/work/npgsql/npgsql/test/Npgsql.NativeAotTests/Npgsql.NativeAotTests.csproj::TargetFramework=net8.0]

We've managed to determine that there is no error if IlcGenerateMstatFile in csproj set to false.

Reproduction Steps

See PR npgsql/npgsql#5060, or just use the latest main and try to publish test\Npgsql.NativeAotTests project.

Expected behavior

There shouldn't be an error from compiler while publishing NativeAOT project with IlcGenerateMstatFile = true.

Actual behavior

There is an error from compiler while publishing NativeAOT project with IlcGenerateMstatFile = true.

Regression?

Yes, was working fine with .NET 8 preview 3.

Known Workarounds

No response

Configuration

,NET 8.0.100-preview.4.23260.5
Ubuntu-22.04, x64. Can also repro on Windows 10 19044.2965, x64.

Other information

No response

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions