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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:41:04+00:00 2026-06-16T00:41:04+00:00

I have started experiencing errors in WCF deserialization today – in code which has

  • 0

I have started experiencing errors in WCF deserialization today – in code which has been unchanged and working for months.

The issue is that I am getting runtime XmlExceptions saying ‘Name cannot begin with the ‘<‘ character’. I have debugged into the .NET source, and it seems the error is in deserializing return objects from our WCF service calls. These objects are defined using automatic properties, and it seems the backing fields are given names like <MyProperty>k_BackingField, which is where the XmlException is coming from.

I’ve seen a couple of other references online where the solution people accept is “I changed my code to not use automatic properties”, which isn’t really acceptable to me, as I would have 100s of objects to change, (with 1000s of properties amongst them). Also, this same code was working fine when I ran it last week, and doesn’t seem to affect all serialized DTOs, only some.

To make it even more frustrating, it seems mildly intermittent. On occasion this morning, there has been no exception thrown…!

Questions;

  1. Why has this problem suddenly appeared in unchanged code and unchanged framework source?
  2. How do I fix this without modifying all the DTOs to use fully implemented properties?

UPDATE: After a day or so of working fine, this issue has reappeared – no reason I can find why it would work/not work/work again, but here we are.

I have tracked the problem down further to be related to some code I have on my ServiceContracts using the ServiceKnownType attribute, which is used to define known types for serialization. It seems that although the types being reported with errors are not even part of the service call I am making at the time, that this error is occurring on types which are part of this known types ‘publishing’ behaviour.

The problem occurs when I use some proxy creation code to apply some service behaviours;

IOperationBehavior innerBehavior = new PreserveReferencesOperationBehavior(
    description, this.preserveReferences, this.maxItemsInObjectGraph);
innerBehavior.ApplyClientBehavior(description, proxy);

I cannot debug the ApplyClientBehavior code as it is part of System.ServiceModel (or can I?), but something in that method is trying to validate all types I have published using my ServiceKnownType attribute, and breaking on some of them with this XmlException. I have NO IDEA why some of the types are failing – and only for some of their properties.

This is an example of the types which are getting errors reported against them;

[Serializable]
public class MyDataObject
{
    public ActivitySession(string id)
    {
        this.Id = id;
        this.IsOpen = true;
    }

    public string Id { get; set; }

    public bool IsValid { get; set; }
}

The exception reported an error against Id -> <Id>k_BackingField cannot start with '<'

So nothing controversial in that class, and no inheritance to consider. It’s not even part of a service contract, only it was previously published as a known type for serialization.

This is getting quite esoteric now, so I’m not expecting an answer, but just updating where the problem is at.

  • 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-06-16T00:41:04+00:00Added an answer on June 16, 2026 at 12:41 am

    I think I have found more information to help explain this issue, (at least in so far as why the error is appearing on certain types only).

    The DTOs which are getting exceptions reported against them are;

    • published as part of my [ServiceKnownType] attribute
    • marked with [Serializable]
    • NOT marked with [DataContract]

    Adding the [DataContract] attribute to the type resolves this issue. I have no idea why, and still no idea why this error is intermittent in when it happens, but consistent in what it affects.

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

Sidebar

Related Questions

Today I have been experimenting with SQL binary objects. I started by storing an
I'm trying to get my ad hoc build distributed but have started experiencing problems.
We have an old (written in CakePHP 1.1!) application that has started groaning under
I have alert boxes all around my site, that have been working up until
I have been using SSMS and LinqPad both for months to connect to SQL
I just started experimenting with java today (have experience with javascript and PHP) and
I have been experimenting with MVC (started out yesterday) and was wondering if I
I have just started experiencing this problem: The site is fine until I add
I have been trying to write a simple mention grabber to get started with
I have recently started experimenting with Django for some web applications in my spare

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.