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 1028109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:20:13+00:00 2026-05-16T12:20:13+00:00

I am having problems creating WCF client proxy for service code like in this

  • 0

I am having problems creating WCF client proxy for service code like in this example:

// data classes
[KnownType(typeof(ClassA))]
[KnownType(typeof(ClassB))]
public abstract class BaseClass : Dictionary<string, ITest>
{
}

public class ClassA : BaseClass
{
}

public class ClassB : BaseClass
{
}


public interface ITest
{
}

// service
[ServiceContract]
public interface IService1
{
    [OperationContract]
    BaseClass Method();
}

public class Service1 : IService1
{
    public BaseClass Method()
    {
        ...
    }
}

Whenever I try to create a WCF proxy using “Add Service Reference” in VS it fails and trace log says

Type ‘WcfProxyTest.ClassA’ cannot be added to list of known types since another type ‘WcfProxyTest.ClassB’ with the same data contract name ‘http://schemas.microsoft.com/2003/10/Serialization/Arrays:ArrayOfKeyValueOfstringanyType‘ is already present. If there are different collections of a particular type – for example, List<Test> and Test[], they cannot both be added as known types. Consider specifying only one of these types for addition to the known types list.

I can see what the error message is saying, but is there any other way around this (other than refactoring the classes). I am dealing with a legacy system which has classes written in the same manner as in my example and rewriting them is not an option as this stuff sits in the very core of the system :S

Any ideas? Thanks!

  • 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-16T12:20:14+00:00Added an answer on May 16, 2026 at 12:20 pm

    I decided to refactor the code in such a way that I don’t have to provide two KnownTypes which gets me around the problem. About 300 syntax errors later that worked. I would be interested in any other ways of doing it though…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In OpenGL, the texture origin is at the bottom left… May 16, 2026 at 11:29 pm
  • Editorial Team
    Editorial Team added an answer WPF is the latest UI framework from Microsoft, it has… May 16, 2026 at 11:29 pm
  • Editorial Team
    Editorial Team added an answer This is not possible as it would be a (gaping)… May 16, 2026 at 11:29 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm creating a WCF service that may be used either locally or remotely, and
I have a self-hosted WCF service and I'm having the following problem: 15 minutes
Hey i'm having problems creating a simple button for a programme which finds the
I'm having problems creating a regular expression which will fix a valid string. The
I'm having problems creating a collection of delegate using reflection and generics. I'm trying
I have been having problems creating a relative layout in XML for a list
I'm having problems with creating a Facelet Composition Control (= custom tag). That's the
Suppose I am creating an Android application that's like an SMS app. The requirements
I have a WCF that is in use now for over a year, coded
I'm using a UserNamePasswordValidator in WCF along with Unity for my dependency injection, but

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.