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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:03:55+00:00 2026-06-12T02:03:55+00:00

I just replaced the previous protobuf-net build which I was using in my code

  • 0

I just replaced the previous protobuf-net build which I was using in my code base (version 2.0.0.480) with the latest build (version 2.0.0.580) – since there is no specific build against .Net 4.0 or .Net 4.5 in the latest protobuf version, I am referencing the net30 full dll in my projects.

When trying to serialize a complex type which includes a System.Xml.Linq.XElement I get an InvalidOperationException from the protobuf serializer – the exception message states :
“No serializer defined for type: System.Xml.Linq.XElement”

I am assuming that the lack of a serializer for XElement relates to the fact that there is no .Net 4.0 build (since I’m referencing v4.0.30319 of the System.Xml.Linq.dll in my project).

My project targets the .NET 4.5 platform – it works fine when referencing the protobuf-net V2.0.0.480 net40 build.

  • 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-12T02:03:56+00:00Added an answer on June 12, 2026 at 2:03 am

    This looks like it is related to “parseable types” – things that don’t have inbuilt handling, but which meet certain patterns allowing them to be treated as a string. This has caused a few problems in the past, so is optionally supported, via .AllowParseableTypes:

    static void Main()
    {
        XElement el = XElement.Parse("<xml />");
        var model = TypeModel.Create(); // store and re-use this; don't use
        model.AllowParseableTypes = true; // a new one each time! (very bad)
    
        var foo = new Foo { Bar = el };
        var clone = (Foo) model.DeepClone(foo);
        var cloneEl = clone.Bar;
    }
    [ProtoContract]
    class Foo
    {
        [ProtoMember(1)]
        public XElement Bar { get; set; }
    }
    

    Note that the reason I had to declare a Foo here is that it looks like the “root object” handling (which is quite different to handling members / sub-objects) isn’t checking for parseable types; I’ll have to investigate why not and fix it. I would hope that the following would work (it doesn’t currently, but probably should):

    static void Main()
    {
        XElement el = XElement.Parse("<xml />");
        var model = TypeModel.Create(); // store and re-use this; don't use
        model.AllowParseableTypes = true; // a new one each time! (very bad)
    
        var cloneEl = (XElement)model.DeepClone(el);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to validate a USA mobile number, since I'm using pre-built javascript validation
Hi I have a sqlite3 database full of data from my previous version of
The following CSharp Code(just sample): Console.WriteLine(Searching file in...); foreach(var dir in DirList) { Console.WriteLine(dir);
Im actually new to using this function.. and was using preg_replace and addslashes previous
I inherited some source code that I am just starting to dig though, and
I have a large block of HTML that needs to be replaced, which includes
I have a vector (I actually just retrieved individual columns from a dataframe) which
I need an expression for PHP preg_replace so just replace [ and ] with
How do I use an HTML as a template then just replace the text
I just decided to replace phpMyAdmin by Mysql Query Browser ( finally I can

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.