Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5838827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:30:34+00:00 2026-05-22T11:30:34+00:00

I have an asynchronous WCF server (I’ve derived my own clientbase class) and I

  • 0

I have an asynchronous WCF server (I’ve derived my own clientbase class) and I call this from my client application.

However, when this method is called:

public IAsyncResult Beginxxx(string path, AsyncCallback callback, object state)  
{
    return Channel.Beginxxx(path, callback, state); 
}

I get this exception:

{“There was an error while trying to serialize parameter http://tempuri.org/:callback. The InnerException message was ‘Type ‘System.DelegateSerializationHolder+DelegateEntry’ with data contract name ‘DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System’ is not expected. Add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.’. Please see InnerException for more details.”}

If I had my own class with its own properties, this exception would make sense but this is a standard .NET type (AsyncCallback I believe the exception is complaining about). A code sample of what I am trying to do doesn’t have this problem (and I changed that to the same type of binding I am using – named pipes).

What is wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:30:34+00:00Added an answer on May 22, 2026 at 11:30 am

    You likely forgot to add the (AsyncPattern = true) property in the [OperationContract] attribute. The example below shows two clients, one (wrong) with the exact error you’re seeing, one (correct) which works. The only difference is the AsyncPattern = true in the operation contract.

        public class StackOverflow_5999249_751090
    {
        [ServiceContract(Name = "ITest", Namespace = "")]
        public interface ITest
        {
            [OperationContract]
            string Echo(string path);
        }
    
        public class Service : ITest
        {
            public string Echo(string path) { return path; }
        }
    
        [ServiceContract(Name = "ITest", Namespace = "")]
        public interface ITestClient_Wrong
        {
            [OperationContract]
            IAsyncResult BeginEcho(string path, AsyncCallback callback, object state);
            string EndEcho(IAsyncResult asyncResult);
        }
    
        [ServiceContract(Name = "ITest", Namespace = "")]
        public interface ITestClient_Correct
        {
            [OperationContract(AsyncPattern = true)]
            IAsyncResult BeginEcho(string path, AsyncCallback callback, object state);
            string EndEcho(IAsyncResult asyncResult);
        }
    
        static void PrintException(Exception e)
        {
            int indent = 2;
            while (e != null)
            {
                for (int i = 0; i < indent; i++)
                {
                    Console.Write(' ');
                }
    
                Console.WriteLine("{0}: {1}", e.GetType().FullName, e.Message);
                indent += 2;
                e = e.InnerException;
            }
        }
    
        public static void Test()
        {
            string baseAddress = "net.pipe://localhost/Service";
            ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddress));
            host.AddServiceEndpoint(typeof(ITest), new NetNamedPipeBinding(), "");
            host.Open();
            Console.WriteLine("Host opened");
    
            AutoResetEvent evt = new AutoResetEvent(false);
    
            Console.WriteLine("Correct");
            ChannelFactory<ITestClient_Correct> factory1 = new ChannelFactory<ITestClient_Correct>(new NetNamedPipeBinding(), new EndpointAddress(baseAddress));
            ITestClient_Correct proxy1 = factory1.CreateChannel();
            proxy1.BeginEcho("Hello", delegate(IAsyncResult ar)
            {
                Console.WriteLine("Result from correct: {0}", proxy1.EndEcho(ar));
                evt.Set();
            }, null);
            evt.WaitOne();
    
            Console.WriteLine("Wrong");
            ChannelFactory<ITestClient_Wrong> factory2 = new ChannelFactory<ITestClient_Wrong>(new NetNamedPipeBinding(), new EndpointAddress(baseAddress));
            ITestClient_Wrong proxy2 = factory2.CreateChannel();
            try
            {
                proxy2.BeginEcho("Hello", delegate(IAsyncResult ar)
                {
                    try
                    {
                        Console.WriteLine("Result from wrong: {0}", proxy2.EndEcho(ar));
                    }
                    catch (Exception e)
                    {
                        PrintException(e);
                    }
                    evt.Set();
                }, null);
                evt.WaitOne();
            }
            catch (Exception e2)
            {
                PrintException(e2);
            }
    
            Console.WriteLine("Press ENTER to close");
            Console.ReadLine();
            host.Close();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF client/server app which is communicating over HTTP using the WSHttpBinding.
I have a WCF service client implemented using the asynchronous event (using /async and
I have a WCF service that I call from a windows service. The WCF
I am implementing an asynchronous command pattern for the client class in a client/server
I'm building an application that uses a WCF client to retrieve data from my
I have a WCF client which passes Self-Tracking Entities to a WPF application built
I have a legacy C++ application that uses DDS for asynchronous communication/messaging. I need
My form receives asynchronous callbacks from another object on random worker threads. I have
I have an application that uses MSMQ for asynchronous processing of certain things. I
I have a wcf client that before doing some complicated interactions with the wcf

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.