Skip to content

Release-only build error when using ParamsSource with a LINQ method: Cannot implicitly convert type 'object' #2011

@cthompson92

Description

@cthompson92

I believe this might be a bug in BDN 0.13.1, though I have tried 0.12.0 and 0.12.1 and had issues with those versions as well - granted, slightly different issues.

This is on Net6.0, in a solution with both C# and F# code.

0.13.1:

// Found 27 benchmarks:
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Blog1]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Blog2]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Blog3]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Blog4]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Blog5]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Blog6]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Blog7]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Quicksort1]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array1, FSharpBenchmark=Quicksort2]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Blog1]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Blog2]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Blog3]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Blog4]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Blog5]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Blog6]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Blog7]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Quicksort1]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array2, FSharpBenchmark=Quicksort2]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Blog1]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Blog2]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Blog3]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Blog4]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Blog5]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Blog6]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Blog7]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Quicksort1]
// InjectedFSharpQuicksortBenchmarks.FSharpQuicksorts: DefaultJob [FSharpData=FSharp - Array3, FSharpBenchmark=Quicksort2]
// Build Error: Standard output:
Standard error:
Time Elapsed 00:00:01.49
27 Error(s)
0 Warning(s)
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(12600,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(14796,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(14064,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(13332,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(11868,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(15528,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(11136,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(10404,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(16260,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(9672,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(8940,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(8208,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(7476,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(5280,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(6012,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(6744,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(16992,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(4548,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(17724,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(3816,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(3084,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(18456,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(2352,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(156,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(19188,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(1620,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(888,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
Build FAILED.
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(12600,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(14796,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(14064,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(13332,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(11868,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(15528,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(11136,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(10404,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(16260,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(9672,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(8940,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(8208,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(7476,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(5280,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(6012,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(6744,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(16992,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(4548,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(17724,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(3816,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(3084,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(18456,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(2352,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(156,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(19188,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(1620,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\08f4e2d5-bf72-436a-a197-73cf761f1905.notcs(888,35): error CS0266: Cannot implicitly convert type 'object' to 'Benchmarks.Abstract.IFSharpQuicksortDataSource'. An explicit conversion exists (are you missing a cast?) [D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905\BenchmarkDotNet.Autogenerated.csproj]
Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Build Engine version 17.1.1+a02f73656 for .NET
// BenchmarkDotNet has failed to build the auto-generated boilerplate code.
// It can be found in D:\git\fsharp.project1\Benchmarks\bin\Release\net6.0\08f4e2d5-bf72-436a-a197-73cf761f1905
// Please follow the troubleshooting guide: https://benchmarkdotnet.org/articles/guides/troubleshooting.html
// ** Remained 0 benchmark(s) to run **
Run time: 00:00:00 (0.1 sec), executed benchmarks: 0

I've been able to narrow down the issue to this approach to generating parameterized benchmark data:

public class InjectedFSharpQuicksortBenchmarks
{
    private readonly Consumer consumer = new Consumer();

    public static IEnumerable<IFSharpQuicksortDataSource> FSharpDataSources()
    {
        // throws build error in RELEASE, but works in DEBUG compilation
        var converter = new CSharpToFSharpQuicksortDataSourceConverter();

        return InjectedCSharpQuicksortBenchmarks.CSharpDataSources().Select(x => converter.Convert(x));
    }

    [ParamsSource(nameof(FSharpDataSources))]
    public IFSharpQuicksortDataSource FSharpData { get; set; }

    public static IEnumerable<IFSharpQuicksortBenchmark> FSharpBenchmarks()
    {
        // omitted for brevity
    }

    [ParamsSource(nameof(FSharpBenchmarks))]
    public IFSharpQuicksortBenchmark FSharpBenchmark { get; set; }

    [Benchmark]
    public void FSharpQuicksorts()
    {
        FSharpBenchmark.Run(FSharpData.Data).Consume(consumer);
    }
}

However, if I change this approach to use classes directly, I do not encounter the issue:

public class InjectedFSharpQuicksortBenchmarks
{
    private readonly Consumer consumer = new Consumer();

    public static IEnumerable<IFSharpQuicksortDataSource> FSharpDataSources()
    {
        // works fine
        yield return new FSharpQuickSortArray1DataSource();
        yield return new FSharpQuickSortArray2DataSource();
        yield return new FSharpQuickSortArray3DataSource();
    }

    [ParamsSource(nameof(FSharpDataSources))]
    public IFSharpQuicksortDataSource FSharpData { get; set; }

    public static IEnumerable<IFSharpQuicksortBenchmark> FSharpBenchmarks()
    {
        // omitted for brevity
    }

    [ParamsSource(nameof(FSharpBenchmarks))]
    public IFSharpQuicksortBenchmark FSharpBenchmark { get; set; }

    [Benchmark]
    public void FSharpQuicksorts()
    {
        FSharpBenchmark.Run(FSharpData.Data).Consume(consumer);
    }
}

Related classes:

// multiple similar classes to this, with different int[] arrays 
public class CSharpQuicksortArray1DataSource : ICSharpQuicksortDataSource
{
    public string Category => "Array1";

    public int[] Data { get; } = BenchmarksData.A1;

    public override string ToString() => Category;
}

// packages up a CSharp int[] into an FSharpList<int> for the F# implementation
public class CSharpToFSharpQuicksortDataSourceConverter : ICSharpToFSharpQuicksortDataSourceConverter
{
    public IFSharpQuicksortDataSource Convert(ICSharpQuicksortDataSource data)
    {
        return new FSharpQuickSortDataSource(data.Data, data.Category);
    }

    private class FSharpQuickSortDataSource : IFSharpQuicksortDataSource
    {
        public FSharpList<int> Data { get; }
        public string Category { get; }
        
        public FSharpQuickSortDataSource(IEnumerable<int> data, string category)
        {
            Data = ListModule.OfSeq(data);
            Category = category;
        }
        
        public override string ToString()
        {
            return $"FSharp - {Category}";
        }
    }
}

// multiple similar classes to this, with different int[] arrays packaged into FSharpList<int>
public class FSharpQuickSortArray1DataSource : IFSharpQuicksortDataSource
{
    public string Category => "Array1";

    public FSharpList<int> Data { get; } = ListModule.OfSeq(BenchmarksData.A1);

    /// <summary>Returns a string that represents the current object.</summary>
    /// <returns>A string that represents the current object.</returns>
    public override string ToString() => Category;
}

I'm curious if I'm doing something that is strictly unsupported here, or if this is just an odd edge case I've found myself in.

Solution to reproduce this can be found here

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions