Skip to content
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

[4.0] Problem running BenchmarkDotNet when referencing projects with Orleans dependencies #7751

Closed
christiansparre opened this issue May 20, 2022 · 0 comments · Fixed by #7753

Comments

@christiansparre
Copy link
Contributor

I'm having trouble running BenchmarkDotNet benchmarks when referencing projects that have Orleans dependencies.

The code benchmarked is not directly using Orleans stuff, it's just in a project that have Orleans dependencies.

I have been able to reproduce this in a simple project here: https://github.com/christiansparre/orleans4-benchdotnet-repro

It's probably a minor thing as test/Benchmarks seems to work fine. I have tried a few of the csproj settings from there without luck.

The output I get from BenchmarkDotNet is below. To me it seems to be related to the Orleans code generation?

$ dotnet run --project .\src\OrleansPlayground.Benchmarks\OrleansPlayground.Benchmarks.csproj -c Release
// Validating benchmarks:
// ***** BenchmarkRunner: Start   *****
// ***** Found 1 benchmark(s) in total *****
// ***** Building 1 exe(s) in Parallel: Start   *****
// start dotnet restore  /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109
// command took 1,28s and exited with 0
// start dotnet build -c Release  --no-restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109
// command took 2,18s and exited with 1
// start dotnet build -c Release  --no-restore --no-dependencies /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109
// command took 1,66s and exited with 1
// ***** Done, took 00:00:05 (5.2 sec)   *****
// Found 1 benchmarks:
//   SomeBenchmark.One: DefaultJob

// Build Error: Standard output:

 Standard error:
 Time Elapsed 00:00:01.45
    9 Error(s)
    0 Warning(s)
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(20,21): error CS0116: A namespace cannot directly contain members such as fields, methods or statements [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,12): error CS1729: 'TypeManifestProviderAttribute' does not contain a constructor that takes 8 arguments [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,179): error CS0103: The name 'ccca3e7d109' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,173): error CS0103: The name 'adba' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,164): error CS0103: The name 'bd9' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,133): error CS0103: The name 'ccca3e7d109' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,127): error CS0103: The name 'adba' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,118): error CS0103: The name 'bd9' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,93): error CS0118: 'OrleansCodeGen' is a namespace but is used like a type [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
Build FAILED.
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(20,21): error CS0116: A namespace cannot directly contain members such as fields, methods or statements [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,12): error CS1729: 'TypeManifestProviderAttribute' does not contain a constructor that takes 8 arguments [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,179): error CS0103: The name 'ccca3e7d109' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,173): error CS0103: The name 'adba' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,164): error CS0103: The name 'bd9' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,133): error CS0103: The name 'ccca3e7d109' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,127): error CS0103: The name 'adba' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,118): error CS0103: The name 'bd9' does not exist in the current context [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\60993086-2bd9-4d24-adba-7ccca3e7d109.orleans.g.cs(12,93): error CS0118: 'OrleansCodeGen' is a namespace but is used like a type [C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109\BenchmarkDotNet.Autogenerated.csproj]
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET

// BenchmarkDotNet has failed to build the auto-generated boilerplate code.
// It can be found in C:\Git\Private\github\christiansparre\orleans4-benchdotnet-repro\src\OrleansPlayground.Benchmarks\bin\Release\net6.0\60993086-2bd9-4d24-adba-7ccca3e7d109
// Please follow the troubleshooting guide: https://benchmarkdotnet.org/articles/guides/troubleshooting.html
// ***** BenchmarkRunner: Finish  *****

// * Export *
  BenchmarkDotNet.Artifacts\results\SomeBenchmark-report.csv
  BenchmarkDotNet.Artifacts\results\SomeBenchmark-report-github.md
  BenchmarkDotNet.Artifacts\results\SomeBenchmark-report.html

// * Detailed results *
SomeBenchmark.One: DefaultJob
Runtime = ; GC =
There are not any results runs

// * Summary *

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
Intel Core i7-10850H CPU 2.70GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK=6.0.300
  [Host] : .NET 6.0.5 (6.0.522.21309), X64 RyuJIT


| Method | Mean | Error |
|------- |-----:|------:|
|    One |   NA |    NA |

Benchmarks with issues:
  SomeBenchmark.One: DefaultJob

// * Legends *
  Mean  : Arithmetic mean of all measurements
  Error : Half of 99.9% confidence interval
  1 ns  : 1 Nanosecond (0.000000001 sec)

// * Diagnostic Output - MemoryDiagnoser *


// ***** BenchmarkRunner: End *****
// ** Remained 0 benchmark(s) to run **
Run time: 00:00:00 (0.19 sec), executed benchmarks: 0

Global total time: 00:00:05 (5.4 sec), executed benchmarks: 0
// * Artifacts cleanup *
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant