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

Global.CloudStorage.SaveStorage() throw Serialization Exception #330

Open
sunkararp opened this issue Jan 13, 2021 · 21 comments
Open

Global.CloudStorage.SaveStorage() throw Serialization Exception #330

sunkararp opened this issue Jan 13, 2021 · 21 comments

Comments

@sunkararp
Copy link

Hi Grapheengine team,

I’m getting Serialization Exception when I call Global.CloudStorage.SaveStorage() methid,
Any Idea how to fix this?

System.Runtime.Serialization.SerializationException
HResult=0x8013150C
Message=Type 'System.ValueTuple2[[Trinity.DynamicCluster.Storage.ReplicaInformation, Trinity.DynamicCluster, Version=2.0.10792.0, Culture=neutral, PublicKeyToken=null],[Trinity.DynamicCluster.PersistedSlice, Trinity.DynamicCluster, Version=2.0.10792.0, Culture=neutral, PublicKeyToken=null]]' in Assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' is not marked as serializable. Source=mscorlib StackTrace: at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func`2 valueFactory)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(WriteObjectInfo objectInfo, NameInfo memberNameInfo, WriteObjectInfo memberObjectInfo)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at Trinity.DynamicCluster.Utils.Serialize[T](T payload) in C:\Research\GraphEngine\src\Modules\GraphEngine.DynamicCluster\Trinity.DynamicCluster\Utils.cs:line 162
at Trinity.ServiceFabric.Infrastructure.Interfaces.ReliableTaskQueue.<>c__DisplayClass13_0.<b__0>d.MoveNext()

This exception was originally thrown at this call stack:
[External Code]
Trinity.DynamicCluster.Utils.Serialize(T) in Utils.cs
[External Code]

@TaviTruman
Copy link
Contributor

@sunkararp please post the offending code here so that I can assist your further.

@sunkararp
Copy link
Author

My code is very simple, Service Fabric satefull remoting service & client
My code is here https://github.com/sunkararp/Ayushman.KgApplication.

Exception is happening when client calls Global.CloudStorage.SaveStorage() method at ln@231 of file https://github.com/sunkararp/Ayushman.KgApplication/blob/main/Ayushamn.KgClient/GraphEngineRemotingClient.cs

the client, calls protocol methods before calling Global.CloudStorage.SaveStorage()
the service, protocol me saves the data Global.LocalStorage.SaveStorage

@TaviTruman
Copy link
Contributor

TaviTruman commented Jan 15, 2021

@sunkararp you've done too much unnecessary work here. Firstly, you must use the graph data model generated via TSL; I do not see any TSL in your project. The Graph Engine TSL compiler will generate especially generated typed C# files for you. This is one of the very powerful aspects of the Graph Engine; the graph data model is codegen for you. You willl need to use those generated classes. It does not seem like you've read the documentation - you must do that and take a look at the Sample Graph Service Fabric project.

@sunkararp
Copy link
Author

On server side, I'm using TSL generated code to write memory (like Global.LocalStorage.SavePatientNode(cell))
Please see my code https://github.com/sunkararp/Ayushman.KgApplication/tree/main/Ayushman.KgProtocols

@TaviTruman
Copy link
Contributor

@sunkararp Yikes - I did not see that - my bad. Are you using those same generated files in your remoting client?

@sunkararp
Copy link
Author

Yes, client does following...

  • Create TSL generated object
  • Set all the properties
  • Call the protocol method

` var organization = new OrganizationT();
organization.Id = o.Id;
organization.Name = o.NAME;
organization.Revenue = o.REVENUE;
organization.Phone = o.PHONE;
organization.Utilization = o.UTILIZATION;

            using var cell = new AddOrganizationRequestWriter(organization);
            using var res2 = m_trinity.AddOrganization(cell);`

@TaviTruman
Copy link
Contributor

@sunkararp Just a moment - I am testing your project.

@TaviTruman
Copy link
Contributor

@sunkararp Just a moment - you are running a back release of the Graph Engine Library.

@sunkararp
Copy link
Author

I didn't understand your question.
Below is what I did...

  • I cloned GraphEngine repo
  • Compiled locally, Windows10 & VS2019
  • In my application, used the locally generated Nugets

@TaviTruman
Copy link
Contributor

@sunkararp no worries - I have made many updates to my local repro and so my local build is ahead of yours. I just need to get to one of my dev machines with that build on it.

@sunkararp
Copy link
Author

Just uploaded Data files here

@TaviTruman
Copy link
Contributor

@sunkararp Thanks!

@TaviTruman
Copy link
Contributor

@sunkararp I'll have the fix for you shortly after I get other production matters resolved.

@TaviTruman
Copy link
Contributor

@sunkararp I'm working on your code now and I will have an update for you shortly.

@TaviTruman
Copy link
Contributor

@sunkararp found the problem! I'm updating your project with corrections. I'll come back here when I the VS solution ready.

@sunkararp
Copy link
Author

sunkararp commented Jan 20, 2021

Thank you so much for the help,
can you share your email ID, I have few more questions.
My email ID is [email protected]

@sunkararp
Copy link
Author

Any luck here?

@TaviTruman
Copy link
Contributor

@sunkararp I will post the fix tomorrow. I've been very busy with pushing out a new release.

@sunkararp
Copy link
Author

Any update here?

@TaviTruman
Copy link
Contributor

TaviTruman commented Oct 16, 2021

@sunkararp The current implementation for GE to run in Service Fabric major rework of the runtime must take place. After much review with Microsoft Service Fabric team and an outside third party it has been determined by the current tcp/ip stack is not compatible with SF due to the advanced use of duplex sockets. However, I have reworked the part of the networking stack so that it's compatible with SF. The scheduled release of the build will not be ready until the December / January timeframe. Also as I'm not able to update the Microsoft Graph Engine github repo current at this time and new versions of the GE will appear at my InKnowWorks GraphEngine repo. You can find updated Nuget packages there with support for. Net 3.1,. Net 5 and 6. We are very actively working on the Graph Engine so that an modernized and updated version is available. I'll post an updated Readme file today sighting updates, and schedule availability and road map.

@TaviTruman
Copy link
Contributor

@sunkararp I have been working on the GE/SF implementation in the background and finally have more time to address this problem. I hope to have a fix in place next week.

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

No branches or pull requests

2 participants