Skip to content

Interop source generators failing build in dotnet/runtime when latest SDK is installed #92655

Closed

Description

@ericstj

Description

When building for older frameworks the latest interop source generator is used, which ends up forcing the latest shared library Microsoft.Interop.SourceGeneration.dll while still using older source generators. This makes the older source generators break if there are breaking changes to the internal Microsoft.Interop.SourceGeneration.dll.

Reproduction Steps

Build C:\src\dotnet\runtime\src\libraries\Common\tests\TestUtilities\TestUtilities.csproj

Expected behavior

Builds successfully

Actual behavior

Build fails with

CSC : error CS8784: Generator 'VtableIndexStubGenerator' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'TypeLoadException' with message 'Could not load type 'Microsoft.Interop.TargetFramework' from assembly 'Microsoft.Interop.SourceGeneration, Version=42.42.42.42, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.'

Regression?

Yes,

Known Workarounds

No response

Configuration

No response

Other information

I attempted to fix this in #92648 before fully understanding the problem.

Activity

  1. ghost added
    needs-area-label
    on Sep 26, 2023
  2. ghost added
    untriaged
    on Sep 26, 2023
  3. added and removed
    needs-area-label
    on Sep 26, 2023
  4. ghost added
    in-pr
    on Sep 26, 2023
  5. ericstj commented on Sep 26, 2023

    @ericstj
    MemberAuthor

    #92660 has a good workaround for folks blocked on this. Thank you @jtschuster!

  6. ghost removed
    untriaged
    on Sep 27, 2023
  7. ghost removed
    in-pr
    on Sep 29, 2023
  8. ghost locked as resolved and limited conversation to collaborators on Oct 29, 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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions