Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • 03:17
    REASY opened #1731
  • Jun 21 08:49
    timcassell commented #784
  • Jun 21 07:21
    adamsitnik closed #1730
  • Jun 21 07:21
    adamsitnik commented #1730
  • Jun 21 07:18
    adamsitnik closed #1688
  • Jun 20 02:19
    timcassell edited #1730
  • Jun 20 02:11
    timcassell opened #1730
  • Jun 18 16:21
    workgroupengineering synchronize #1702
  • Jun 17 14:49
    adamsitnik milestoned #1729
  • Jun 17 14:49

    adamsitnik on master

    Set ValidateExecutableReference… (compare)

  • Jun 17 14:49
    adamsitnik closed #1729
  • Jun 17 14:49
    adamsitnik closed #1728
  • Jun 17 14:07
    naricc commented #1729
  • Jun 17 14:07
    naricc synchronize #1729
  • Jun 17 14:05
    naricc synchronize #1729
  • Jun 17 08:23
    adamsitnik commented #1729
  • Jun 17 00:46
    naricc edited #1729
  • Jun 17 00:46
    naricc opened #1729
  • Jun 16 18:39
    naricc commented #1728
  • Jun 16 18:05
    naricc commented #1728
Tomasz Kajetan Stańczak
I end up scrolling up and looking for tables after each run
Stephan Grein
hey folks.
is there any update on the possibility to use BenchmarkDotNet with Unity?

While migrating webapplication from .netcore 2.1 to .netcore 3.1, I am getting runtime exception as

System.InvalidOperationException: 'The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time. Configure the CORS policy by listing individual origins if credentials needs to be supported.'
How to resolve System.InvalidOperationException?

not sure you're in the good channel here, it does'nt seems related to benchmark at all
Tebjan Halm
Hi, is there any guide on how to do a benchmark programmatically?
without using attributes... just: start measure (with params), do something (several times), stop, get results
the idea of attribute i suppose is to avoid the buggy measure you would have by dirrectly calling code
because you would have to warmup stuff and so on
Tebjan Halm
the problem is, i am in an environment that doesn't do static compilation/reflection. it's a live-programming environment that does compilation at runtime: https://visualprogramming.net/
so I can call warm-up things myself, if necessary
why not generate code with the attrbutes then ?
do you want bench or metrics ?
that's 2 different thing
also you could open https://github.com/dotnet/BenchmarkDotNet
and try to extract the logic you're looking for
that might exists, i never took a look at it to be fair
Tebjan Halm
yes, that would by my fallback strategy, I was hoping there was some kind of guide or example somewhere
maybe opening an issue on the repo itself as a [QUESTION] ....
including details about your context and limitation might help you have a cleaner answer
Tebjan Halm
yes, thanks
i wonder if you could find something here
if you get an answer on that i'll be curoius ^^
Tebjan Halm
@tebeco i've created an issue: dotnet/BenchmarkDotNet#1445
Sebastiano Mandalà
Jumping in quickly to ask what config you would suggest me to use to have fast benchmark iterations without the result being meaningless. Running a benchmark on simple code takes minutes
Jason Bock

I just tried to create a couple of benchmark tests, and....I got this error:

error MSB4086: A numeric comparison was attempted on "$(LangVersion)" that evaluates to "latest" instead of a number, in condition "'$(LangVersion)' == '' Or '$(LangVersion)' < '7.3'".

I've never seen that one before :). Any ideas why I'm getting this, and how to get rid of it?

Jason Bock
Seems like if I have <LangVersion> set to latest, that's why I'm getting that error. Sounds like a bug to me. I'll submit something to the GitHub issues list.
Bad idea of the day ....
Can BenchmarkDotnet do bisect so that we could detect threshold in the code,
public ValueTuple<int, int> RequestSize = (8, 4096)

public void Foo()
  //Code will run with 
  // 0 => Alloc ?
  // 4096  => Alloc ?
   // (4096-0)/2 => Alloc ?
  // ....
i'm not sure if that would makes any sense to be fair
it would be a bit like a FlatMap/Reduce
Florian Verdonck
I created my first benchmark today and now I'm wondering what to do with it.
How many times do I want to run it? And what is the best strategy for saving the results after a CI build?
Because I guess you want to compare the results with previous runs, so what is the best way to do that.
Eugene Krapivin
Hey guys!
is there a support planned for TeamCity? storing the files and comparing between builds and presenting the delta?
I automatic create word document in server side
I use microsoft.introp.word not working on IIS
show this error
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor) at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions) at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
please help me
Hi everyone. I created a Visual Studio Console project for benchmarking, and ran this just fine (by doing Ctrl+F5 to run it without the debugger). I then tried using the command line (as Adminstrator) c:\.......\myapp.exe and I got the following error: Generate Exception: Access to the path 'C:\WINDOWS\system32\LogFiles\WMI\RtBackup' is denied.. What am I missing?
1 reply
Johannes Rössel [yWorks]
Good morning; I've got a bit of a problem with a ParamsSource that requires STA. It seems as if the parameters are queried at a point where the STAThread attribute of the benchmark (for understandable reasons, actually) is not yet "active". Right now I'm working around this by using the parameter as string and then using reflection in a GlobalSetup method to pick the correct instance, but is there a nicer way? Attributing the method that's called for ParamsSource with STAThread doesn't help either. In my case I'd be fine if everything ran with STA anyway, so some global option would also be okay.
Is it possible to Setup some code only once per assembly, not per test method as GlobalSetup does?
Similarly, is it possible to initialize some code per class?
We have some third party libraries that can only be initialized/terminated once and we also generate some data that should be shared between tests.
Johannes Rössel [yWorks]
@gpetrou Wouldn't a static initializer of any type that's used in benchmarks do the trick?
@jroessel I assume you are talking about the code per class case? I will check that. But assuming that this will work, how can Cleanup happen once per class or assembly?
Ivan Kochurkin
Hi! Is it possible to export to csv raw nanoseconds 18 instead of formatted form like 0.0184 ms?
Reason: I'm comparing several runtimes and need in normalized benchmark time.
Adam Sitnik
hi @KvanTTT SummaryStyle is what you are looking for
var summaryStyle = new SummaryStyle
    PrintUnitsInHeader = true,
    PrintUnitsInContent = false,
    SizeUnit = SizeUnit.B,
    TimeUnit = TimeUnit.Nanosecond

config = config.With(summaryStyle);
Ivan Kochurkin
Yes, I've already found it, but thank you! :thumbsup:
Jason Bock
Is there any way to run a project with benchmark tests where LangVersion is set to preview? I want to test some stuff I'm writing for .NET 5.0 and I need to use C# 9 features, but when I have preview in play, I get:
error MSB4086: A numeric comparison was attempted on "$(LangVersion)" that evaluates to "preview" instead of a number, in condition "'$(LangVersion)' == '' Or '$(LangVersion)' < '7.3'".
Jason Bock
Nevermind....I set it to 9.0 and apparently that worked :)
Can we use dependency injection setup same as we do in dotnet core project for Benchmark Test?
Daniel Hughes
I've run into an issue trying to create benchmarks for a .NET 5 c# source generator. It appears that it doesn't accept the LangVersion being set to Preview, but this is currently required for c# source generators
It doesn't work if set to 9.0 like what worked for @JasonBock
Clinton Ingram
What does it do if you set it to 9.0? That's the correct solution