Skip to content

Crossgen2 should emit a warning or error when two different versions of the same assembly are referenced #114513

@MarkOsborneMS

Description

@MarkOsborneMS

Description

When updating Roslyn to use version 9 of the .NET libraries build authoring was accidentally updated to reference two different versions of System.Reflection.Metadata.dll this resulting in an assembly being generated that produced an unexpected MissingMethod exception - it took us a while to work out that crossgen we the source of the issue.

It would be nice if crossgen emitted a warning or error message so that this mistake could be caught at build time.

Reproduction Steps

Call crossgen2 with the same assembly referenced twice with different versions.

e.g.

--reference:Q:\.tools\.nuget\packages\microsoft.netcore.app.runtime.win-x64\8.0.13\runtimes\win-x64\lib\net8.0\System.Reflection.Metadata.dll
--reference:C:\Users\gel\roslyn\artifacts\bin\Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.x64\Debug\net8.0\publish\CrossGen\OriginalAssemblies\System.Reflection.Metadata.dll

Expected behavior

An error or warning

Actual behavior

An assembly is created that generates an unexpected MissingMethod exception

Regression?

No response

Known Workarounds

No response

Configuration

Windows, x64
crossgen2 version 8.0.13

Other information

No response

Metadata

Metadata

Assignees

Type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions