dotnet / dotnet/BenchmarkDotNet

Support `extern alias` in generated code.

Open
#2,289 5 comments 0 reactions 0 assignees View on GitHub
Area:CodeGen Area:Toolchains enhancement
Dominant language
C#
Stars
11.5k
Forks
1.1k
Avg merge
6d 11h
Merged PRs (30d)
12

Description

I was benchmarking the old and new version of my library and the benchmark methods were returning objects of a type with the same name from the old or new assembly. I can't vary the NuGet package versions because the new version is not yet released and the API is different.

In my benchmark code I used `extern alias` to point to the old library but this did not carry over to the code BenchmarkDotNet generated, causing `error CS0433: The type 'Grammar' exists in both 'Farkle, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'FarkleNeo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'`.

I found a workaround by returning `object` so I guess it's a pretty niche scenario.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.