Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement cross-platform json serializer and spec #2947

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

Arkatufus
Copy link
Contributor

NOTE:

  • Only merge this when there are requests from users for net framework - net core cross platform support.
  • The serializer would have lower performance than the regular one.

{
string data = JsonConvert.SerializeObject(obj, Formatting.None, Settings);
#if CORECLR
data = data.Replace("System.Private.CoreLib", "%CORE%");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not enough. There is more System.Private.* assemblies, like System.Private.Uri

@ITHedgeHog
Copy link

Hi, we are potentially looking at doing this as we have certain back end services which will take 6 to 12 months to convert to .Net Core.

One question: when you say lower performance on the serializer, do you have any feel for how much of a performance hit we would be talking? Are we talking 10-20% hit or 80-90% hit?

@paulinfrancis
Copy link

We are also interested in a hybrid architecture consisting of some legacy systems on full framework, and new development with .NET Core.

@notour
Copy link

notour commented May 10, 2018

I copy this serializer and it work for me. (Client .net 4.7.1 -> Cluster .net Core 2.0)

I have to Add a specific Identifier and replace the Preprocess condition "#if CORECLR" by a runtime check if i'm runing in .net core or .net classic.

For now the only solution i found to check if i run in .net core is :

    /// <summary>
    /// Gets the net core version.
    /// </summary>
    public static string GetNetCoreVersion()
    {
        var assembly = typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly;
        var assemblyPath = assembly.CodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
        int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App");
        if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2)
            return assemblyPath[netCoreAppIndex + 1];
        return null;
    }

@Aaronontheweb
Copy link
Member

@notour would you like to send an updated PR with that code change? Appreciate the info!

@ptjhuang
Copy link
Contributor

We're looking for this capability also.

@notour
Copy link

notour commented May 16, 2018

I made a pull request :

Arkatufus#2

@leo12chandu
Copy link

I have an implementation for Hyperion to work across .Net Core to .NET Full framework. Currently it supports collections that switch between mscorlib to System.Private.CorLib as well as ExpandoObjects going from System.Dynamic to System.Linq.

https://github.com/leo12chandu/akka.net/blob/dev/src/core/Akka/Serialization/HyperionByteHelper.cs

@ghost
Copy link

ghost commented Mar 14, 2019

Hello,

What is the current state of this?

We are (unfortunately) still having to target .NET Framework as the WPF on .NET Core will not be ready for us in time and have just hit this issue.

Regards
JC

@Aaronontheweb
Copy link
Member

@john-cullen we should probably implement @leo12chandu's changes

@leo12chandu
Copy link

@Aaronontheweb - I would be happy to branch out from akka.net master, implement it and create a pull request for you to review if it helps merge so others can use it. I've performance tested it 6 months back with reasonable size payloads and its does not add more than 10-20 milliseconds for our objects with over a 1000 properties per object.

Usage defined at #3587

@awostenberg
Copy link

Any developments?

We have a situation of a legacy .net framework app, new actors in .net core core...

and I was pleasantly surprised today to find there is some level of interoperability out of the box (it formed a cluster, an actor in .net core taking strings from actor in .net framework worked fine)
but quickly hit deserialization problems,this PR would fix, e.g. "Error [Error resolving type specified in JSON 'System.Collections.Generic.List`1[[Shared.Messages.MergeOneString, Shared]], System.Private.CoreLib'."

@ghost
Copy link

ghost commented May 31, 2019

@awostenberg I went with modifying the serialised text for now. I've not had any problems with it (but my app is still in testing / pre-release)

https://gist.github.com/john-cullen/c39d56efcb15e60b66cd4d05149316ed

@edvinasz
Copy link

@john-cullen you saved me. It took me 3 days of banging my head against why our system is just not working. Long and behold once we connected our WPF .NET framework clients they don't communicate messages with arrays in them (with cryptic dissociation errors). Once I discovered this thread I was concerned that this is going to be a showstopper for our effort to port our WCF to akka.net (months of effort), since our WPF apps can't be converted to .net core anytime soon. It would be really nice, going forward, to integrate @leo12chandu solution for planed 1.5 release when akka.net switches to Hyperion. Thanks.

@Aaronontheweb
Copy link
Member

@Arkatufus I know you're OOF, but maybe we should just merge this in - I can think of several support customers who are going to run into this as they execute their migrations off of .NET Framework this year.

@Aaronontheweb
Copy link
Member

Probably need a feature toggle for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants