GraphEngine: Failed to serialize 'FanoutSearch.Action' to a type object.
my environment: Ubuntu16.04 x64 .NetCore 2.1.4 GraphEngine.Core 1.0.9083 (I build it myself,The NuGet package outdated.) GraphEngine.LIKQ 1.0.9083
My main test code:
Global.LocalStorage.LoadStorage(); TrinityConfig.HttpPort = 80; FanoutSearchModule.EnableExternalQuery(true); FanoutSearchModule.SetQueryTimeout(3000); FanoutSearchModule.RegisterIndexService(Indexer); FanoutSearchModule.RegisterExpressionSerializerFactory(ExpressionSerializerFactory); TrinityServer server=new TrinityServer(); server.RegisterCommunicationModule<FanoutSearchModule>(); server.Start();
the exception throws at ` public class ExpressionSerializer:IExpressionSerializer { private static XmlSerializer m_serializer = null; private static NodeFactory m_factory = null;
public ExpressionSerializer()
{
m_serializer=new XmlSerializer();
m_serializer.AddKnownType(typeof(FanoutSearch.Action));
m_factory=new NodeFactory();
}
public string Serialize(Expression pred)
{
//Exception throws here
return pred.ToXml(m_factory,m_serializer);
}
public Func<ICellAccessor, Action> DeserializeTraverseAction(string pred)
{
var func_exp = m_serializer.Deserialize<LambdaExpressionNode>(pred)
.ToExpression<Func<ICellAccessor, FanoutSearch.Action>>();
return func_exp.Compile();
}
public Func<ICellAccessor, bool> DeserializeOriginPredicate(string pred)
{
var fun_exp = m_serializer.Deserialize<LambdaExpressionNode>(pred)
.ToExpression<Func<ICellAccessor, bool>>();
return fun_exp.Compile();
}
}`
Exceptions Trace:
Unhandled Exception: System.Runtime.Serialization.SerializationException: Failed to serialize ‘FanoutSearch.Action’ to a type object.
at Serialize.Linq.Nodes.TypeNode.ToType(IExpressionContext context)
at Serialize.Linq.Nodes.ConstantExpressionNode.set_Value(Object value)
at Serialize.Linq.Nodes.ConstantExpressionNode.Initialize(ConstantExpression expression)
at Serialize.Linq.Nodes.ExpressionNode1..ctor(INodeFactory factory, TExpression expression) at Serialize.Linq.Nodes.ConstantExpressionNode..ctor(INodeFactory factory, ConstantExpression expression) at Serialize.Linq.Factories.NodeFactory.Create(Expression expression) at Serialize.Linq.Nodes.LambdaExpressionNode.Initialize(LambdaExpression expression) at Serialize.Linq.Nodes.ExpressionNode1…ctor(INodeFactory factory, TExpression expression)
at Serialize.Linq.Nodes.LambdaExpressionNode…ctor(INodeFactory factory, LambdaExpression expression)
at Serialize.Linq.Factories.NodeFactory.Create(Expression expression)
at Serialize.Linq.Extensions.ExpressionExtensions.ToText(Expression expression, INodeFactory factory, ITextSerializer serializer)
at Serialize.Linq.Extensions.ExpressionExtensions.ToXml(Expression expression, INodeFactory factory, IXmlSerializer serializer)
at People_LIKQ.ExpressionSerializer.Serialize(Expression pred) in /home/coder/Documents/NetCore/LIKQ-Examples/People-LIKQ/ExpressionSerializer.cs:line 30
at FanoutSearch.ExpressionSerializer.Serialize(Expression pred)
at FanoutSearch.FanoutSearchDescriptor.<>c.<Serialize>b__22_0(Expression pred)
at System.Linq.Enumerable.SelectListIterator2.ToList() at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at FanoutSearch.FanoutSearchDescriptor.Serialize()
at FanoutSearch.FanoutSearchDescriptor._ExecuteQuery()
at FanoutSearch.FanoutSearchDescriptor.GetEnumerator()
at People_LIKQ.Program.LikqQurety() in /home/coder/Documents/NetCore/LIKQ-Examples/People-LIKQ/Program.cs:line 73
at People_LIKQ.Program.Main(String[] args) in /home/coder/Documents/NetCore/LIKQ-Examples/People-LIKQ/Program.cs:line 37
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (13 by maintainers)
hi @esskar! I believe we understand the code and our workaround will address this issue temporarily. We do hope that the assembly loader behaves consistently with
netfxandnetstandard. I know it’s a bit of a trouble fornetcore11because there were no proper support for assembly enumeration, but anyway my suggestion on this is to:netstandard2.0which does support assembly enumeration from AppDomain.netcore11, try to figure out the assembly name from the package id returned fromusing Microsoft.Extensions.DependencyModel.@esskar just confirmed version 1.7.0 is working for
netcoreapp2.0. thank you for your quick update!ooh @esskar that’s great news! trying rightaway, will report back in a few mins. tried to work on this issue two hours ago and it’s still 1.6 😄
@chaosddp you rock! I’m submitting an issue to Serialize.Linq to reference your findings. For now, I’ll set the assembly name to GraphEngine.LIKQ to work around this.