2
votes

I am getting this when trying to parse a simple csv string. I am running F# out of VS 2013, the dll says it is version 4.3.0.1 which I thought was F# 3.1. My Fsharp.Data dll is 1.1.10.

I am trying to run this as part of an nunit test using resharper. The snippet does work in interactive mode.

Here is the code:

open FSharp.Data

type TestCsv = CsvProvider<"test,taht\n1,1">
let x = TestCsv.Parse "test,taht\n1,1"
let tests = x.Data |> Seq.map (fun x -> x.test) 
tests |> Seq.head

And the result:

System.Exception : Couldn't parse row 1 according to schema: Method not found: 'Microsoft.FSharp.Core.FSharpOption`1<System.String> FSharp.Data.RuntimeImplementation.Operations.AsOption(System.String)'.

Any ideas how to fix this?

1
How do you run it? Your snippet works just fine in a clean FSI session. - Gene Belitski
Ah, the plot thickens. So it does work for me in Interactive mode, but not when running an nunit test with resharper. - Steve
Not at all, this may explain the source of the problem. Just ensure that FSharp.Core and FSharp.Data are available for your test execution environment. As a first step, make sure you can execute a simplest F# test that uses FSharp.Core. - Gene Belitski
I am a bit new to F#, would this snippet use FSharp.Core? let x = [1;2;3];; Assert.AreEqual(1, x|>Seq.head) because that worked when running in resharper. - Steve
Yes, Seq.head comes from F# core library. Unfortunately, I do not use Resharper test runner so cannot be more specific, but somehow it must have way to list libraries to be delivered into test run environment. - Gene Belitski

1 Answers

1
votes

FSharp.Data 1.1.10 doesn't support F# 3.1/VS2013. Please try with the prerelease version 2.0.0-alpha3 and let us if that works. Make sure both the unit test project and the library project are using the same version of FSharp.Core (either 4.3.0.0 or 4.3.1.0)