Description
Since 0,14 and the new build system it seems like you can no longer start other referenced cli projects via Process.Start in BenchmarkDotNet.
Background: It seems like the embedded dll is always the one from BenchmarkDotNet now.
This is a COREHOST_TRACE=1 capture of the started project
Tracing enabled @ Wed Nov 13 14:41:27 2024 GMT
--- Invoked apphost [version: 8.0.11 @Commit: 9cb3b725e3ad2b57ddc9fb2dd48d2d170563a8f5] main = {
C:\Dev\TestProj\Src\TestPerfRunner\bin\Net6\Release\net8.0-windows\f4d0ff40-a7b1-4376-b14d-87ef1f70a014\bin\Release\net8.0-Windows7.0\OtherProject.exe
config=C:\Dev\TestProj\Src\TestPerfRunner\bin\Net6\Release\net8.0-windows\f4d0ff40-a7b1-4376-b14d-87ef1f70a014\bin\Release\net8.0-Windows7.0\epsSingle.config
}
Redirecting errors to custom writer.
The managed DLL bound to this executable is: 'f4d0ff40-a7b1-4376-b14d-87ef1f70a014.dll'
The problem is it should be 'OtherProject.dll' instead since that is a completely other project.
The problem only materializes when you use a command line which can not be parsed by the BDN dll and your output will be:
// BeforeAnythingElse
System.FormatException: The input string 'config=C:\Dev\TestProj\Src\TestPerfRunner\bin\Net6\Release\net8.0-windows\f4d0ff40-a7b1-4376-b14d-87ef1f70a014\bin\Release\net8.0-Windows7.0\epsSingle.config' was not in a correct format.
at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1 value)
at System.Int32.Parse(String s)
at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args) in C:\Dev\TestProj\Src\TestPerfRunner\bin\Net6\Release\net8.0-windows\f4d0ff40-a7b1-4376-b14d-87ef1f70a014\f4d0ff40-a7b1-4376-b14d-87ef1f70a014.notcs:line 45
// AfterAll
Instead of running the correct entry point.
Workaround:
we now start dotnet <OtherProject.dll>
instead but it was quite the pain to find and debug this problem, since if you open the .exe or the .dll in DotPeek everything looks nice, and if you don't have actual parameters it will forward to the 'correct' entrypoint.