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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:50:48+00:00 2026-05-14T07:50:48+00:00

Good Day Everyone… I’m getting an unexpected WCF error complaining of Known Types which

  • 0

Good Day Everyone…

I’m getting an unexpected WCF error complaining of “Known Types” which are similarly named, but in different name-spaces (see error below).

…please keep in mind I’m still experimenting with all this.

Also…

I already understand the nature of regular web-services FORCES you to flatten your object hierarchy, but everything I’ve read says you don’t have to do that with WCF…which is why I’m attempting this.

So my questions are…

  • Q: Is it possible to tell WCF to NOT TO IGNORE
    the name-spacing?
  • Q: Am I missing a tag? Don’t the WCF
    tags (below) take name-spacing into
    account?
  • Q: Do I HAVE to flatten my object
    hierarchy?

The basic error is…

Type
‘wcfFISH.StateManagement.Contractor.New’
cannot be added to list of known types
since another type
‘wcfFISH.StateManagement.CostDivision.New’
with the same data contract name
‘wcfFISH.StateManagement.Contractor:New’
is already present.

The error looks like…

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior
 contract: http://tempuri.org/:IFishData ----> System.InvalidOperationException: Type 'wcfFISH.StateManagement.Contractor.New' cannot be added to list of known types since another type 'wcfFISH.StateManagement.CostDivision.New' with the same data contract name 'wcfFISH.StateManagement.Contractor:New' is already present.
   at System.Runtime.Serialization.DataContract.CheckAndAdd(Type type, Dictionary`2 typesChecked, Dictionary`2& nameToDataContractTable)
   at System.Runtime.Serialization.DataContract.ImportKnownTypeAttributes(Type type, Dictionary`2 typesChecked, Dictionary`2& knownDataContracts)
   at System.Runtime.Serialization.DataContract.ImportKnownTypeAttributes(Type type)
   at System.Runtime.Serialization.ClassDataContract.ClassDataContractCriticalHelper.get_KnownDataContracts()
   at System.Runtime.Serialization.ClassDataContract.get_KnownDataContracts()
   at System.Runtime.Serialization.DataContractSet.AddClassDataContract(ClassDataContract classDataContract)
   at System.Runtime.Serialization.DataContractSet.Add(XmlQualifiedName name, DataContract dataContract)
   at System.Runtime.Serialization.DataContractSet.AddClassDataContract(ClassDataContract classDataContract)
   at System.Runtime.Serialization.DataContractSet.Add(XmlQualifiedName name, DataContract dataContract)
   at System.Runtime.Serialization.DataContractSet.Add(Type type)
   at System.Runtime.Serialization.XsdDataContractExporter.Export(Type type)
   at System.ServiceModel.Description.MessageContractExporter.ExportType(Type type, String partName, String operationName, XmlSchemaType& xsdType)
   at System.ServiceModel.Description.DataContractSerializerMessageContractExporter.ExportBody(Int32 messageIndex, Object state)
   at System.ServiceModel.Description.MessageContractExporter.ExportMessage(Int32 messageIndex, Object state)
   at System.ServiceModel.Description.MessageContractExporter.ExportMessageContract()
   at System.ServiceModel.Description.DataContractSerializerOperationBehavior.System.ServiceModel.Description.IWsdlExportExtension.ExportContract(WsdlExporter exporter, WsdlContractConversionContext contractContext)
   at System.ServiceModel.Description.WsdlExporter.CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension)
   --- End of inner ExceptionDetail stack trace ---
   at System.ServiceModel.Description.WsdlExporter.CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension)
   at System.ServiceModel.Description.WsdlExporter.CallExportContract(WsdlContractConversionContext contractContext)
   at System.ServiceModel.Description.WsdlExporter.ExportContract(ContractDescription contract)
   at System.ServiceModel.Description.WsdlExporter.ExportEndpoint(ServiceEndpoint endpoint, XmlQualifiedName wsdlServiceQName)
   at System.ServiceModel.Description.WsdlExporter.ExportEndpoints(IEnumerable`1 endpoints, XmlQualifiedName wsdlServiceQName)
   at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()
   at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData()
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleDocumentationRequest(Message httpGetRequest, String[] queries, Message& replyMessage)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.Get(Message message)
   at SyncInvokeGet(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

The service code looks like…

namespace wcfFISH.StateManagement
{
    [DataContract(Namespace = "wcfFISH.StateManagement")]
    [KnownType(typeof(wcfFISH.StateManagement.C1FE.Approved))]
    [KnownType(typeof(wcfFISH.StateManagement.C1FE.Denied))]
    [KnownType(typeof(wcfFISH.StateManagement.C1FE.New))]
    [KnownType(typeof(wcfFISH.StateManagement.C1FE.Pending))]
    [KnownType(typeof(wcfFISH.StateManagement.Contractor.Authenticated))]
    [KnownType(typeof(wcfFISH.StateManagement.Contractor.New))]
    [KnownType(typeof(wcfFISH.StateManagement.CostDivision.Authenticated))]
    [KnownType(typeof(wcfFISH.StateManagement.CostDivision.New))]
    [KnownType(typeof(wcfFISH.StateManagement.ReportingPeriod.Closed))]
    [KnownType(typeof(wcfFISH.StateManagement.ReportingPeriod.Open))]
    public abstract class ObjectState
    {
        #region CONSTRUCTORS

        protected ObjectState()
        { }

        #endregion

        #region PROPERTIES & FIELDS

        #endregion

        #region EVENTS
        #endregion

        #region METHODS    
        #endregion
    }
}

Side note…

Another reason I am confused is the original declarations listed below NEVER caused an issue…and it was working fine! This only happened when I ADDED CostDivision!

[KnownType(typeof(wcfFISH.StateManagement.C1FE.New))]
[KnownType(typeof(wcfFISH.StateManagement.Contractor.New))]

In case I’m not being clear…

My understanding is WCF should understand the difference between the following classes:

[KnownType(typeof(wcfFISH.StateManagement.Contractor.Authenticated))]
[KnownType(typeof(wcfFISH.StateManagement.Contractor.New))]
[KnownType(typeof(wcfFISH.StateManagement.CostDivision.Authenticated))]
[KnownType(typeof(wcfFISH.StateManagement.CostDivision.New))]

If it does NOT understand…

I guess my only option seems to be to flatten the hierarchy FOR EVERYTHING to:

wcfFISH.StateManagement.Authenticated
wcfFISH.StateManagement.New

…is this my only option? (hope not!)

  • 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-14T07:50:49+00:00Added an answer on May 14, 2026 at 7:50 am

    My psychic powers tell me that your declaration of wcfFISH.StateManagement.CostDivision.New was copy/pasted from wcfFISH.StateManagement.Contractor.New and while you changed the class name you didn’t change the DataContract attribute on it to match.

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

Sidebar

Related Questions

Good Day Everyone... Apparently, I'm not setting-up impersonation correctly for my WCF service. I
Good day everyone. I have an audio class, that plays a .wav file. But
Good day, everyone. I need a compiled and ready-to-use Flash lib, which is able
Good day everyone. Suppose we have a collection and a document which looks something
Good day everyone, i have faced with such an issue as linkage error like
Good Day Everyone, I have a program (lets call it 'A'), which is called
Good day everyone. This problem was part of another one which it as been
Good day everyone, I'm an independent game developer who has, in the past, primarily
Good day everyone, I am building a page in ASP.NET, and using Master Pages
Good day everyone. I am working on a Firefox extension, and I want to

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.