DevTeam / Pure.DI

Pure DI for .NET
MIT License
506 stars 22 forks source link

Running benchmarks on ServiceCollection results in an InvalidCastException #16

Closed MisinformedDNA closed 1 year ago

MisinformedDNA commented 1 year ago

$ .\Pure.DI.Benchmark.exe ServiceCollection Unhandled exception. System.InvalidCastException: Unable to cast object of type 'Pure.DI.Benchmark.Benchmarks.ServiceCollection' to type 'Pure.DI.Benchmark.BenchmarkBase'. at Pure.DI.Benchmark.Program.Main(String[] args) in C:\repos\Pure.DI\Pure.DI.Benchmark\Program.cs:line 26

I'm going to attempt a PR.

MisinformedDNA commented 1 year ago

OK, so it also fails because ServiceCollection doesn't have a PureDI() method.

And if I run .\Pure.DI.Benchmark.exe Singleton, I get

Running benchmark "Singleton".

But then the process ends.

NikolayPianikov commented 1 year ago

Please run like .\Pure.DI.Benchmark.exe --filter *ServiceCollection*

MisinformedDNA commented 1 year ago

That worked. Thanks.

NikolayPianikov commented 1 year ago

I've fixed this issue. I used the syntax '.\Pure.DI.Benchmark.exe Singleton' for profiling. But now it follows a common benchmarks' CLI.

NikolayPianikov commented 1 year ago

There is some mess with benchmarks names, fixed in the last commit