Skip to content

crossgen2 fails when a Managed C++ dll is passed as a reference assembly #67849

Closed
@AArnott

Description

@AArnott

Description

When trying to crossgen2 a C# assembly that was originally compiled with a reference to a Managed C++ dll, crossgen2 fails

This is not asking for support to crossgen a managed C++ dll. But given crossgen2 produces the best native code when the transitive closure of assemblies referenced by a C# assembly are provided, my build script passes in all the reference (or copy local runtime) assemblies. Filtering out the Managed C++ assembly is infeasible because my build script has no insight into the content of the ref assemblies to ascertain which are managed C++. If crossgen2 cannot process these, it should skip them (possibly emitting a warning) instead of emitting an error and bailing out.

Reproduction Steps

crossgen2 somecsharp.dll -r somemanagedcpp.dll

Expected behavior

A successful crossgen run. Ideally with fully compiled native code even in methods that reference APIs from the managed C++ assembly.

Actual behavior

The assembly cannot be crossgen'd at all.

Internal.CommandLine.CommandLineException : error : managed C++ is not supported: (managed c++ dll path)

Regression?

No response

Known Workarounds

I manually drop the reference to the Managed C++ assembly from the CLI and it starts working.
Note this works even while the c# assembly retains the reference to the managed C++ assembly itself.

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions