TGIF again,

The svcutil command is doing something magical when it generates WCF client
code. The generated interface and class have both synchronous and async
methods for each service method. And it doesn't matter if your original
service methods are async or not, you still get pairs generated either way.
If I have a service with a non-async method GetData() and I run it through
svcutil I get a class like this (trimmed):

public class MyServiceClient : ServiceClient<IMyService>
{
  public Task<string> GetDataASync();
  {
    return base.Channel.GetDataAsync();
  }
}

Getting async methods is fabulous, but where on earth do they come and how
do they work? I spied into the IL to see what's happening, but all
generated methods call into a generic TChannel (transparent proxy) which
contains no recognisable code. Is it dynamic code generation? But it gets
worse...

Svcutil generates vast overkill code, so I prefer to make my own client by
manually coding a class with the exact same signature as the generated one
above. This works, but *all the async methods are missing*. What the hell
is the difference between the svcutil generated code and mine? Where did
the async methods come from, and where did they go?

*Greg K*

Reply via email to