Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Jun 13, 2025

This PR enable assembly signing for Debug build also.

Background
When using BenchmarkDotNet.TestAdapter and project contains net462 target.
net462 benchmarks are not shown on TestExplorer with Debug configuration.
And following error log is recorded on VS output window's Tests pane.

System.IO.FileLoadException: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)'

Currently BenchmarkDotNet sign assembly on Release build only.
This PR change this behavior to sign Debug build assembly also.

What's Tested

  • BenchmarkDotNet.Samples (net462) benchmarks are shown on TestExplorer
  • It can display benchmarks on TestExplorer when benchmark project don't use assembly-signing.

@AndreyAkinshin
Copy link
Member

The current behavior of non-signed Debug builds was introduced in commit 5876f57 on April 12, 2016, by @adamsitnik. I am open to reconsidering this, but I would like to understand the use case better. Why do you want to use the Debug build of BenchmarkDotNet through VS TestExplorer?

P.S. BenchmarkDotNet intentionally creates inconveniences to prevent users from running benchmarks with non-optimized assemblies. Therefore, the absence of discovered tests with the Debug version of BenchmarkDotNet seems to be the desired behavior. 🙂

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the problem you have described is specific to our own solution, as all our customers use the Release builds we ship to nuget.org. But I don't mind improving our dev loop experience of course. Thanks for providing the fix @filzrev!

@adamsitnik adamsitnik merged commit f8390f8 into dotnet:master Jun 17, 2025
8 checks passed
@AndreyAkinshin AndreyAkinshin added this to the v0.15.3 milestone Jun 17, 2025
filzrev added a commit to filzrev/BenchmarkDotNet that referenced this pull request Jun 21, 2025
This was referenced Sep 17, 2025
This was referenced Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants