-
-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BenchmarkDotNet should respect LangVersion
project setting
#643
Comments
hi @rpokrovskij thanks for the bug report. I have fixed the issue, you need to wait until this build is green and download <packageSources>
<add key="bdn-nightly" value="https://ci.appveyor.com/nuget/benchmarkdotnet" />
</packageSources> |
LangVersion
project setting
@adamsitnik Thanks for fix! I tried create PR with fix but when I found the commit with this fix, I didn't able to resolve how to fix the behaviour with debug mode. The solution/workaround is - change the configuration from "Debug" to "Release" and change on all projects the the language version to 7.x (same like in debug mode). It will write this settings into *.csproj. I don't know if cases with debug mode is important for scope of this project. Maybe the workaround is good enough, so I didn't open new issue. I hope this will help others when they trying resolve same issue as me. |
Even if you run the benchmark process in Debug, BDN is going to rebuild it and run in Release. Why would you like to benchmark the Debug build? |
Hi,
In release mode I can't debug my code, so I need to switch between debug/release configuration. It involves two main inconveniences.
There is one more scenario I know about (but doesn't bother me now). I know environments where application in production is compiled in debug mode because the debug information is much more valuable than performance gain from release build. In this case, the measuring of performance is still valueable even if performance is not top priority. Maybe I'm missing something. I would love to know more about and improve myself |
Unit tests should test the correctness, benchmarks the performance. There is a HUGE difference for the performance for Debug vs Release builds (in some cases it can be more than x100) and we don't allow to benchmark Debug code on purpose because it does not make any sense (it would be something similar to testing security with anonymous authentication enabled for entire web app). However, I understand you IDE frustration ;) What I can recommend:
|
I use shared project to have the same "test code" for unit tests and benchmark projects when they have common code and direct referencing doesn't work because of platform specific. |
@adamsitnik I'm trying to use BDN with a project where I am using the latest Compiler toolset i.e. <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net5.0;net48</TargetFrameworks>
<OutputType>Exe</OutputType>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<PropertyGroup>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<Configuration>Release</Configuration>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.12.1" />
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.0.0-2.21310.45">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project> However, this fails with the
PS: This seemed related to this issue. Problem is the last check it appears. |
@nietras please update to |
@adamsitnik yeah just discovered that in #1537 thanks! 😀 |
There is VS 2017 solution developed using C# 7.2 (BenchmarkDotNet 0.10.12)
Benchmark Core project created. Using C# 7.2 instruction added to proj file:
The solution can be compiled. But after starting benchmark with
dotnet run -c Release -f netcoreapp2.0 -p "$BenchmarkProjectPath"
those errors produced:
The text was updated successfully, but these errors were encountered: