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

WCF client proxy compile error #27

Closed
robert-gazsi opened this issue Oct 7, 2013 · 8 comments
Closed

WCF client proxy compile error #27

robert-gazsi opened this issue Oct 7, 2013 · 8 comments
Assignees

Comments

@robert-gazsi
Copy link

Thanks for the great work!

There is a problem when I try to use the library on a WCF client.
I have added a reference to the library in both the WCF server and client, but still, I get 14 compile errors on the generated WCF client proxy class in Reference.cs, all similar to this: ...ExpressionNodeOfNewExpressionQsd8_SODT does not implement inherited abstract member 'Serialize.Linq.Nodes.ExpressionNode.ToExpression(Serialize.Linq.ExpressionContext)'

If I comment out all these auto-generated classes with errors from Reference.cs file, it works well.

I am using C# 4.5 and the latest library version from nuget - 1.1.4 from 5/10/2013.

@vsoldatkin
Copy link
Contributor

Seems like you need to ensure your client proxy uses Serialize.Linq classes, not their auto-generated proxies like ExpressionNodeOfNewExpressionQsd8_SODT. Personally I'm trying to aviod using auto-generated stuff for WCF when possible.

That was just an educated guess. Either way I need to look at the code to suggest something.

@esskar
Copy link
Owner

esskar commented Oct 8, 2013

Hi @robert-gazsi , thanks for your post. This looks similar to the issue that was discussed in #23 . To be honest, i never used the auto-generator. But let me have a look if the auto-generation can be improved somehow.

@robert-gazsi
Copy link
Author

You have a good point by not using the VS auto-generated proxy and in fact I just did that after I posted the issue. Even though I had reused this assembly reference on the client as well, some part of it was still being auto-generated in the proxy data contract.
But probably there will be other potential users who might just go ahead with the auto-generated one, and in this case it's better to see what can be done.
Thanks for your help and good work!

@ghost ghost assigned esskar Oct 8, 2013
@edzatarin
Copy link

hi guys,
i had the same problem to esskar, and i dont know to solve it. Everytime that i update my reference, seem the erros, 13 in total, like ....ExpressionNodeOfNewExpressionQsd8_SODT does not implement inherited abstract member...
How do i to solve it?

thanks in advance and sorry for my bad english.

@alkboda
Copy link

alkboda commented May 21, 2014

Hi! Great library and good idea to replace linq expressions to something what could be serialized.
I got same problem as other. So I simply will wait for fix and at this time using that code(maybe anybody will find it useful):

namespace {ProjectName}.{ServiceReferenceName}
{
// #27

public partial class ExpressionNodeOfUnaryExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfBinaryExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfTypeBinaryExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfLambdaExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfParameterExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfListInitExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfNewArrayExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfConstantExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfMethodCallExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfInvocationExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfConditionalExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfMemberExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfMemberInitExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}
public partial class ExpressionNodeOfNewExpressionQsd8_SODT
{
    public override System.Linq.Expressions.Expression ToExpression(Serialize.Linq.ExpressionContext context)
    {
        throw new NotImplementedException();
    }
}

}

@vsoldatkin
Copy link
Contributor

This issue comes from a presence of generic types in the expression nodes hierarchy. Seems like VS code generator cannot reuse them properly while importing service reference. There is also a related bug: every type with non-standard DataContract name cannot be reused by default. Which is particularly noticeable with SERIALIZE_LINQ_OPTIMIZE_SIZE option.

So, in conclusion: Do not use auto-generated clients to work with Serialize.Linq. Data contracts will be all messed up.

Provide a manual WCF client implementation for the service.

There is nothing esskar can fix here without rebuilding all the data contract hierarchy to get rid of the generics and custom data contract names.

@esskar esskar closed this as completed in c917b89 May 22, 2014
@esskar
Copy link
Owner

esskar commented May 22, 2014

I also added a working WCF host/client example

@vsoldatkin
Copy link
Contributor

I see, it appears that only generic types cannot be reused. Other types with custom data contract names are reused just fine.

There are still trash definitions (see Reference.cs in the WcfClientWithServiceReference app) like

public partial class tE : Serialize.Linq.Nodes.ExpressionNode, ...
// tE stands for ExpressionNode`1

But they are not causing problems any more.

The only potential issue I see is that client can break service request deserialization logic by sending him an instance of tE instead of a normal ExpressionNode.

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

5 participants