Question

I have run in a weird behavior.

I am tring to use a C# library: the Neo4jClient

My code in FSI looks like this:

#r "Neo4jClient.dll"
#r "Newtonsoft.Json"


open System
open Neo4jClient

// Define your library scripting code here
let client = new GraphClient(new Uri("http://localhost:7474/db/data"))
client.Connect()

and leads to the following error:

System.MissingMethodException: Method not found: 'Void Newtonsoft.Json.JsonReader.set_DateParseHandling(Newtonsoft.Json.DateParseHandling)'.
   at Neo4jClient.Serialization.CustomJsonDeserializer.Deserialize[T](String content)
   at Neo4jClient.HttpContentExtensions.ReadAsJson[T](HttpContent content, IEnumerable`1 jsonConverters) in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\HttpContentExtensions.cs:line 20
   at Neo4jClient.GraphClient.Connect() in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line 188
   at <StartupCode$FSI_0013>.$FSI_0013.main@() in C:\Users\Mattia\Documents\Visual Studio 2012\Projects\GenChi\GenChiSnooper\Script.fsx:line 12

However, if executed as a F# application, the same code runs properly.

open System
open Neo4jClient

[<EntryPoint>]
let main argv = 

    let client = new GraphClient(new Uri("http://localhost:7474/db/data"))
    client.Connect();
    printfn "Went through..."
    printfn "%A" argv
    0 // return an integer exit code

I am not sure if this issue is library specific. My question is: is there some specific hacking for the use of C# libraries with the FSI?

Tnx.

Était-ce utile?

La solution

Run visual studio as Administrator. and reference latest Newtonsof.Json package:

#I @"..\packages\Neo4jClient.1.0.0.652\lib\net40"
#I @"..\packages\Newtonsoft.Json.6.0.2\lib\net45"

#r "Neo4JClient.dll"
#r "Newtonsoft.Json.dll"
let client = new GraphClient(new Uri("http://host:7474/db/data"))
client.Connect()
printfn "conntected"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top