Skip to content

Missing method System.Collections.Immutable.ImmutableArray when running from F# repl #316

@hoonzis

Description

@hoonzis

I am using BenchmarkDotNet to benchmark F# code. Everything works fine if I run the benchmark from console aplication:

[<EntryPoint>]
let main argv = 
    let summary = BenchmarkRunner.Run<BinomialBenchmark>();

For some quick tests, I wanted to run the benchmark from F# interactive window and here I get the following exception:

System.MissingMethodException: Method not found: 'System.Collections.Immutable.ImmutableArray`1<Byte> System.Reflection.Metadata.MetadataReader.GetBlobContent(System.Reflection.Metadata.BlobHandle)'.

It seems that historically this constructor was removed and added back into Collections.Immutable library, but I am using the latest version (1.3) and it should be in. See: http://stackoverflow.com/questions/29273466/where-is-immutablearray

Furthermore this works fine when running the console application. I thought the issue might be in the versions of referenced libraries, so I went over all BenchmarkDotNet related references in my console application and check that I reference the same ones in FSX:

#r "../packages/BenchmarkDotNet/lib/net45/BenchmarkDotNet.dll"
#r "../packages/BenchmarkDotNet.Core/lib/net45/BenchmarkDotNet.Core.dll"
#r "../packages/BenchmarkDotNet.Toolchains.Roslyn/lib/net45/BenchmarkDotNet.Toolchains.Roslyn.dll"
#r "../packages/BenchmarkDotNet.Diagnostics.Windows/lib/net45/BenchmarkDotNet.Diagnostics.Windows.dll"

#r "../packages/Microsoft.CodeAnalysis.CSharp/lib/net45/Microsoft.CodeAnalysis.CSharp.dll"
#r "../packages/Microsoft.CodeAnalysis.Common/lib/net45/Microsoft.CodeAnalysis.dll" 

#r "../packages/System.Reflection.Metadata/lib/netstandard1.1/System.Reflection.Metadata.dll"
#r "../packages/System.Collections.Immutable/lib/netstandard1.0/System.Collections.Immutable.dll"
#r "../packages/System.Threading.Tasks.Extensions/lib/netstandard1.0/System.Threading.Tasks.Extensions.dll"

I made sure the exact versions are used in the console application. It seems that the some libraries used by the F# interactive runtime are not the same as the once used by the console application.

It seems that similar issue occurs with LinqPad:
#66

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions