Horusiath / Akkling

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

System.create fails on net461 with FPickler serialization exception #75

Closed cotyar closed 6 years ago

cotyar commented 6 years ago

System.create fails on net461 with FPickler serialization exception.

The reason is the absence of Microsoft.FSharp.Quotations support. As a result FsPickler.CreateBinarySerializer() fails in the Akkling.Serialization.ExprSerializer in the Serialization.fs.

The fix so far is to comment lines 43-45 in the System.create in Spawning.fs.

Still testing if it affects anything ...

Horusiath commented 6 years ago

It for sure affects remote deloyment ;) ExprSerializer is there for a reason. AFAIK the problem is that you need to get the latest FsPickler, while by default some older version is loaded.

cotyar commented 6 years ago

:-)

Using FPickler 4.5 (the latest ...) Running in Visual Studio Code F# interactive. (Windows 10)

Also having problems with DotNetty ...

((

On 27 Nov 2017 07:12, "Bartosz Sypytkowski" notifications@github.com wrote:

It for sure affects remote deloyment ;) ExprSerializer is there for a reason. AFAIK the problem is that you need to get the latest FsPickler, while by default some older version is loaded.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Horusiath/Akkling/issues/75#issuecomment-347096788, or mute the thread https://github.com/notifications/unsubscribe-auth/AEvtbSk1T87_-ekValCzfoQwTbvAW3Vvks5s6mDmgaJpZM4Qq4Qp .

Horusiath commented 6 years ago

Wasn't aware, that FsPickler 4+ came out - current repo and tests work using v3.2/v3.3. However this still should work - I see necessary API exposed in FsPickler: https://github.com/mbraceproject/FsPickler/blob/cd7ca27f3868250982c15caad697e0061070bdb5/src/FsPickler/FsPickler/FsPickler.fs#L23

cotyar commented 6 years ago

open System open System.IO

if INTERACTIVE

let cd = Path.Combine(__SOURCE_DIRECTORY__, "bin/Release") System.IO.Directory.SetCurrentDirectory(cd)

endif

I "bin/Release"

r "Akka.dll"

r "Hyperion.dll"

r "Newtonsoft.Json.dll"

r "FSharp.PowerPack.dll"

r "FSharp.PowerPack.Linq.dll"

r "C:/Work2/Demo/packages/FsPickler/lib/net45/FsPickler.dll"

r "Akkling.dll"

r "System.Collections.Immutable.dll"

// #r "C:/Work2/Akkling/src/Akkling/bin/Release/Akkling.dll"

open System open Akkling open Akka.Actor

let system = System.create "basic-sys" <| Configuration.defaultConfig()

Getting the following: let system = System.create "basic-sys" <| Configuration.defaultConfig()

Will check with 3.3 now

cotyar commented 6 years ago

Same story with 3.3 ....

"It for sure affects remote deloyment ;)" - yep, I know ... but currently it doesn't start even with no remote deployment (which is my use case currently) ((

cotyar commented 6 years ago

Tried VS 15.5.0 Preview 4 (latest) - same story ... ((

Horusiath commented 6 years ago

Strange - the Akkling solution itself uses FsPickler 3.3 (see paket.lock) and I was working on it yesterday without issues. I'll take a look at it today. I want to get the new release within the next 1-2 days after fixing few bugs.

cotyar commented 6 years ago

Hi Bartosz, Downloaded the latest project on another machine (with your update half-day back) and basic.fsx works. (so System.create issue looks solved). But cluster-node-status.fsx failes as before with: [ERROR][27/11/2017 12:25:11][Thread 0006][Akka.Remote.Transport.DotNetty.TcpTransport] Failed to bind to Unspecified/localhost:5000; shutting down DotNetty transport. Cause: System.TypeInitializationException: The type initializer for 'DotNetty.Transport.Channels.DefaultChannelId' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified. at DotNetty.Common.Internal.Logging.InternalLoggerFactory.GetInstance(String name) at DotNetty.Common.Internal.Logging.InternalLoggerFactory.GetInstance[T]() at DotNetty.Transport.Channels.DefaultChannelId..cctor()

cotyar commented 6 years ago

Thank you Bartek!

Horusiath commented 6 years ago

@cotyar that's the case of DotNetty - one of its versions added shitton of assemblies as dependencies. I haven't updated all *.fsx files to reference them all since then.

cotyar commented 6 years ago

I tried to add Microsoft.Extensions.Logging.Abstractions directly without any affect to the error so far unfortunatelly. Will keep trying ...

cotyar commented 6 years ago

Microsoft.Extensions.Logging.Abstractions is a separate nuget which DotNetty depends on but doesn't list as a dependency. Added it to paket.dependencies, paket.references and tried both 1.1.1 DotNetty asks for and 2.0 which is the latest. Same error, no luck :-( (after #r "...")

cotyar commented 6 years ago

My bad.

Adding to paket.dependencies: nuget Microsoft.Extensions.Logging nuget Microsoft.Extensions.Logging.Abstractions

To paket.references: Microsoft.Extensions.Logging Microsoft.Extensions.Logging.Abstractions

To fsx:

r "../src/Akkling.Cluster.Sharding/bin/Debug/Microsoft.Extensions.Logging.dll"

r "../src/Akkling.Cluster.Sharding/bin/Debug/Microsoft.Extensions.Logging.Abstractions.dll"

r "../src/Akkling.Cluster.Sharding/bin/Debug/DotNetty.Buffers.dll"

r "../src/Akkling.Cluster.Sharding/bin/Debug/DotNetty.Codecs.dll"

r "../src/Akkling.Cluster.Sharding/bin/Debug/DotNetty.Common.dll"

r "../src/Akkling.Cluster.Sharding/bin/Debug/DotNetty.Handlers.dll"

Solves the issue.

Horusiath commented 6 years ago

Closing this one. FsPickler dependency has been removed in 0.9 and will no longer be necessary.