Je ne peux pas obtenir Chiron Json serializer fonctionnant sur Elementary OS avec VS Code.
Sous Windows, il fonctionne comme je l'ai testé. Sous MacOS, il fonctionne également si je me souviens bien.
Voici la solution minimale qui ne fonctionne pas :
Voici le fichier script. App.fsx
:
#load "paket-files/include-scripts/net46/include.chiron.fsx"
open Chiron
printfn "%A" (Object <| Map.ofList [ "foo", String "bar" ] |> Json.format)
C'est le paket.dependencies
fichier :
source https://www.nuget.org/api/v2
nuget Chiron
Les scripts d'inclusion doivent être générés. Soit à partir de l'IDE, soit en exécutant mono ./paket/paket.exe generate-include-scripts
.
Quand je cours fsharpi App.fsx
Je reçois l'erreur suivante :
/tmp/test/stdin(0,1): error FS0078: Unable to find the file 'FParsecCS.dll' in any of
/usr/lib/mono/4.5
/tmp/test/./packages
/tmp/test
/usr/lib/cli/fsharp/
System.TypeInitializationException: The type initializer for 'Escaping' threw an exception.
at Chiron+Formatting+formatObject@728-1.Invoke (System.Tuple`2[T1,T2] tupledArg) [0x0000f] in <57e2953614a049a0a74503833695e257>:0
at Microsoft.FSharp.Core.FSharpFunc`2[T,TResult].InvokeFast[V] (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] func, T arg1, TResult arg2) [0x00018] in <566a0818dff9fae1a745038318086a56>:0
at Chiron+Formatting+join@667-2[a].Invoke (System.Text.StringBuilder b) [0x00029] in <57e2953614a049a0a74503833695e257>:0
at Chiron+Formatting+join@666-1[a].Invoke (Microsoft.FSharp.Collections.FSharpList`1[T] values, System.Text.StringBuilder b) [0x00013] in <57e2953614a049a0a74503833695e257>:0
at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3252[T2,TResult,T1].Invoke (T2 u) [0x00001] in <566a0818dff9fae1a745038318086a56>:0
at Chiron+Formatting+formatObject@726-6.Invoke (System.Text.StringBuilder x) [0x00013] in <57e2953614a049a0a74503833695e257>:0
at Chiron+Formatting+formatObject@726-7.Invoke (System.Text.StringBuilder x) [0x00001] in <57e2953614a049a0a74503833695e257>:0
at Chiron+Formatting+formatObject@726-8.Invoke (System.Text.StringBuilder x) [0x00001] in <57e2953614a049a0a74503833695e257>:0
at Chiron+Formatting+Json.format (Chiron+Json json) [0x00013] in <57e2953614a049a0a74503833695e257>:0
at <StartupCode$FSI_0001>.$FSI_0001.main@ () [0x00046] in <6e3acc116b9749ea9b5dc27663d21170>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <8f2c484307284b51944a1a13a14c0266>:0
Stopped due to error
Si vous n'êtes pas sous Linux, l'erreur peut être reproduite avec docker comme ceci :
docker run -it -v $(pwd):/tmp/ttt fsharp/fsharp bin/bash
Mise à jour
De même, le fait de référencer directement les assemblages ne fonctionne pas :
#r "packages/Aether/lib/net35/Aether.dll"
#r "packages/FParsec/lib/net40-client/FParsecCS.dll"
#r "packages/FParsec/lib/net40-client/FParsec.dll"
#r "packages/Chiron/lib/net40/Chiron.dll"
open Chiron
printfn "%A" (Object <| Map.ofList [ "foo", String "bar" ] |> Json.format)