Horusiath / Akkling

Experimental F# typed API for Akka.NET
Apache License 2.0
225 stars 44 forks source link

f# interactive (dotnet fsi) throws System.IO.FileNotFoundException: Newtonsoft.Json #120

Open badgh opened 4 years ago

badgh commented 4 years ago

I try to run in fsi this basic example:

// script.fsx
#I @"packages\"
#r @"Newtonsoft.Json\lib\netstandard2.0\Newtonsoft.Json.dll"
#r @"Akka.Serialization.Hyperion\lib\netstandard1.6\Akka.Serialization.Hyperion.dll"
#r @"Akka\lib\netstandard1.6\Akka.dll"
#r @"Akka.Streams\lib\netstandard1.6\Akka.Streams.dll"
#r @"Akkling\lib\netstandard1.6\Akkling.dll"
#r @"Akkling.Streams\lib\netstandard1.6\Akkling.Streams.dll"

open Akka
open Akka.Streams
open Akkling
open Akkling.Streams

let system = System.create "streams-sys" <| Configuration.defaultConfig()
let mat = system.Materializer()

then run the script with: dotnet fsi script.fsx

This gives the following error:

> dotnet fsi .\script.fsx
[WARNING][25/10/2019 11:51:07][Thread 0001][ActorSystem(streams-sys)] The type name for serializer 'hyperion' did not resolve to an actual Type: 'Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion'
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.
File name: 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
   at Akka.Serialization.NewtonSoftJsonSerializer..ctor(ExtendedActorSystem system, NewtonSoftJsonSerializerSettings settings)
   at Akka.Serialization.NewtonSoftJsonSerializer..ctor(ExtendedActorSystem system)

   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at Akka.Serialization.Serialization..ctor(ExtendedActorSystem system)
   at Akka.Actor.Internal.ActorSystemImpl.ConfigureSerialization()
   at Akka.Actor.Internal.ActorSystemImpl..ctor(String name, Config config)
   at Akka.Actor.ActorSystem.CreateAndStartSystem(String name, Config withFallback)
   at Akka.Actor.ActorSystem.Create(String name, Config config)
   at Akkling.System.create(String name, Config config)
   at <StartupCode$FSI_0001>.$FSI_0001.main@()
Stopped due to error

I also tried all other versions of Newtonsoft.Json.

I use the latest F# Interactive, available by running dotnet fsi: Microsoft (R) F# Interactive version 10.6.0.0 for F# 4.7 All packages were installed with paket for framework: netstandard2.0 dotnet --info: .NET Core SDK Version: 3.0.100 Commit: 04339c3a26

codingedgar commented 3 years ago

Add hyperion?

#r "packages/Newtonsoft.Json/lib/netstandard2.0/Newtonsoft.Json.dll"
#r "packages/Hyperion/lib/netstandard2.0/Hyperion.dll"
#r "packages/Akka.Serialization.Hyperion/lib/netstandard2.0/Akka.Serialization.Hyperion.dll"
#r "packages/Akka/lib/netstandard2.0/Akka.dll"