Skip to content

crossgen2 fails on assemblies that include embedded types #67855

Closed

Description

@AArnott

Description

The .NET 6 runtime supports type equivalence which comes from embedding types (EmbedInteropTypes=true on a reference, or using the /link parameter to csc.exe instead of /reference for an embeddable assembly).
Crossgen2 fails to compile assemblies that contain embedded types (one that was compiled with /link).

Reproduction Steps

The minimal embeddable type in the assembly doesn't seem to repro the problem. So all I can do is offer the full original repro, ready to run (😉): via OneDrive for Business.
Just extract the .zip and run repro.cmd.

Expected behavior

crossgen completes successfully.

Actual behavior

crossgen2 crashes with this exception:

Error: [embedding-referenced-assembly]embedded-type
System.NotImplementedException: [embedding-referenced-assembly]embedded-type
   at ILCompiler.DependencyAnalysis.ReadyToRun.ModuleTokenResolver.GetModuleTokenForType(EcmaType type, Boolean throwIfNotFound)
   at ILCompiler.DependencyAnalysis.ReadyToRun.SignatureContext.GetTargetModule(TypeDesc type)
   at ILCompiler.DependencyAnalysis.ReadyToRun.TypeFixupSignature.GetData(NodeFactory factory, Boolean relocsOnly)
   at ILCompiler.DependencyAnalysis.ReadyToRun.ImportSectionNode.MaterializeSignature(NodeFactory r2rFactory)
   at ILCompiler.DependencyAnalysis.ReadyToRun.ImportSectionsTableNode.MaterializeSignature()
   at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestMetadataTableNode.ComputeLastSetOfModuleIndices()
   at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestMetadataTableNode.GetManifestAssemblyMvidTableData()
   at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestAssemblyMvidHeaderNode.GetData(NodeFactory factory, Boolean relocsOnly)
   at ILCompiler.DependencyAnalysis.ReadyToRunObjectWriter.EmitPortableExecutable()
   at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile)
   at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext)
   at ILCompiler.Program.Run(String[] args)
   at ILCompiler.Program.Main(String[] args)

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Apr 11, 2022
  2. jkoritzinsky commented on Apr 11, 2022

    @jkoritzinsky
    Member

    Related: #64413

  3. davidwrighton commented on Apr 29, 2022

    @davidwrighton
    Member

    I've been worried this could happen for some time. I have a WIP branch with some of the support needed, but its pretty old and incomplete.

  4. removed
    untriagedNew issue has not been triaged by the area owner
    on Jun 15, 2022
  5. added this to the 7.0.0 milestone on Jun 15, 2022
  6. modified the milestones: 7.0.0, 8.0.0 on Jul 27, 2022
  7. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jul 6, 2023
  8. added a commit that references this issue on Jul 6, 2023
    d510ea2
  9. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Jul 6, 2023
  10. ghost locked as resolved and limited conversation to collaborators on Aug 5, 2023
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions